diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d68ff34d5..4f87ccd0c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ should change the heading of the (upcoming) version to include a major version b - Updated docs for ArrayFieldItemTemplate to include prop `onCopyIndexClick`, fixing [#4507](https://github.com/rjsf-team/react-jsonschema-form/issues/4507) - Use antd 5 in playground +- Updated docs to clarify that errors raised within a widget are not caught during form validation # 5.24.8 diff --git a/packages/docs/docs/advanced-customization/custom-widgets-fields.md b/packages/docs/docs/advanced-customization/custom-widgets-fields.md index 86240d14b7..628752fee8 100644 --- a/packages/docs/docs/advanced-customization/custom-widgets-fields.md +++ b/packages/docs/docs/advanced-customization/custom-widgets-fields.md @@ -94,7 +94,15 @@ The default widgets you can override are: ## Raising errors from within a custom widget or field -You can raise a custom error by overriding the `onChange` method to raise field/widget errors: +You can raise custom 'live validation' errors by overriding the `onChange` method to provide feedback while users are actively changing the form data. +Note that these errors are temporary and are not recognized during the form validation process. + +:::warning + +This method of raising errors _only_ runs during `onChange`, i.e. when the user is changing data. This will not catch errors `onSubmit`, i.e when submitting the form. +If you wish to add generic validation logic for your component, you should use the [`customValidate` Form prop](../api-reference/form-props.md#customvalidate). + +::: ```tsx import { ErrorSchema, RJSFSchema, UiSchema, WidgetProps, RegistryWidgetsType } from '@rjsf/utils';