react-inform icon indicating copy to clipboard operation
react-inform copied to clipboard

Getting list of errors explicitly

Open indeyets opened this issue 7 years ago • 3 comments

Currently, react-inform has forceValidate() which exposes snapshot of errors to the props. We found ourselves in a situation when we need to get full list of current errors synchronously.

Do you think a method which returns a copy (?) of form.state.errors could be introduced?

indeyets avatar Mar 23 '17 08:03 indeyets

@indeyets In your use case, do you want errors that are currently not shown to the UI because the inputs haven't been touched yet?

theadam avatar Apr 10 '17 14:04 theadam

@theadam yup. strictly speaking we want to handle the case of incomplete initial data and, additionally, to have a safeguard against bogus initial data

we could resolve this via pre-processing, but in this case it looks like it's easier to do this at the point of form submission

indeyets avatar Apr 10 '17 15:04 indeyets

@indeyets Have you taken a look at the included form submit buttons.

Not sure if this is exactly what you want, but: https://github.com/theadam/react-inform/blob/master/src/feedbackFormSubmit.js

This will show any errors when a user tries to submit the form. There is also a callback when the form is invalid. Let me know if this is close to what you want.

theadam avatar May 02 '17 16:05 theadam