NewOldMax / react-form-validator-core

Core validator component for react forms
MIT License
94 stars 44 forks source link

return validation result on submit #16

Closed ulisesbocchio closed 6 years ago

NewOldMax commented 6 years ago

Hi, Thanks for your work, but can you give some reasons for this changes? What kind of problem you trying to solve?

ulisesbocchio commented 6 years ago

I trigger the submit action directly through a reference to the ValidatorForm, so I gotta know weather validation was successful or not.

NewOldMax commented 6 years ago

If your validation was successful your submit function will execute, right? Also you have onError function that triggers when some validations are failed and isFormValid to get current form validation state

ulisesbocchio commented 6 years ago

yeah, I check wether the form is valid or not after submit. Since I'm triggering directly, it doesn't sound like a good idea to break apart the logic of checking into a 'onSubmit. AlsoisFormValid` re-runs validation in dry mode, which is a waste since the result is RIGHT THERE. Any other option has unnecessary overhead.

NewOldMax commented 6 years ago

Thanks for your work