kettanaito / react-advanced-form

Functional reactive forms. Multi-layer validation, custom styling, field grouping, reactive props, and much more.
https://redd.gitbook.io/react-advanced-form
MIT License
217 stars 24 forks source link

Expose "invalidFields" in the result of "form.validate()" call #346

Open kettanaito opened 5 years ago

kettanaito commented 5 years ago

What

I suggest to expose invalidFields list within arguments of form.validate() payload.

Why

This dramatically increases the debugging, as otherwise a form needs to have an explicit onInvalid callback. This shouldn't affect the flow, since form.validate() is, if called, performed manually anyway.

This would also allow to access the flat list of all error messages, as opposed to trying to get that from the fields Map.

The existing form validate/submit flow remains as-is.