laravel/precognition

onValidate Callback or async validate

joncarlson opened this issue · 6 comments

Because a validate does a roundtrip to the server, it would be nice to know when that roundtrip is finished.

For example, we have a multi-step form. The fields in each step need to be valid before being able to proceed to the next step.

I would think adding a couple options to the .validate(), similar to the .submit(), would be a great addition, something like:

form.validate(id, { onValidated: function(isValid: boolean) {} })

This is a very common problem that occurs in wizards and other situations where you need to wait for validation.
See
#47 (comment)
#51

I see this was closed, but I don't see a resolution for it. Was there a resolution to this? The linked issues are more "hacks" to get around the form not having a validation callback

We will be adding this feature. Follow along in #59