Closed joncarlson closed 9 months ago
This is a very common problem that occurs in wizards and other situations where you need to wait for validation. See https://github.com/laravel/precognition/issues/47#issuecomment-1753201254 https://github.com/laravel/precognition/issues/51
Thanks @mreduar
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 https://github.com/laravel/precognition/issues/59
Opened for review: https://github.com/laravel/precognition/pull/69
Merged and tagged.
<TextInput
v-model="form.name"
@change="form.validate('name', {
onSuccess: () => /* ... */,
onValidationError: () => /* .. */,
})"
/>
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) {} })