react-jsonschema-form icon indicating copy to clipboard operation
react-jsonschema-form copied to clipboard

Form doesn't call "onError" when component was mounted with invalid form data according to schema

Open zarendar opened this issue 7 years ago • 3 comments

Description

I want to be able to get error list if validation wasn't passed when Form component was mounted.

Steps to Reproduce

  1. I've set valid "schema"
  2. I've set invalid formData according to "schema"
  3. I've set "liveValidate" to True
  4. I've mounted component to DOM

Expected behavior

The component should call "onError" with errors list

Actual behavior

The component wasn't called "onError" with errors list

Version

"^1.0.1"

P.s. Can you make me as a contributor and I will push Pull request with fix this problem ?

zarendar avatar Apr 13 '18 11:04 zarendar

Any progress or solution?

lianzhao avatar Apr 25 '21 12:04 lianzhao

I've also run into this issue. I am using rjsf as part of a larger form, and need to handle all the change and error events manually in my external form. I need onError to fire on init so I can disable my external submit button.

Here's a codepen showing the issue: https://codepen.io/antman888/pen/vYJxVga

antman888 avatar Oct 26 '21 00:10 antman888

Here is a codesandbox with the above example migrated to the latest 5.x release

heath-freenome avatar Apr 09 '23 22:04 heath-freenome