Closed makroxyz closed 1 year ago
Hi there,
Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:
However, this issue will not be locked and everyone is still free to discuss solutions to your problem!
Thanks.
@driesvints can I open a feature request for form.validate()? I think it could be useful to let pass a string or an array of strings with field(s) to validate
You can always attempt a PR to see if Taylor would accept it 👍
@makroxyz you can use the form.touch
and form.touch
helpers to modify what is supposed to be validated.
For example, when attempting to go to the next page you might do the following...
form.touch(['name', 'email', 'address']).validate()
This will validate all the fields, even if they have not been interacted with by the user.
If you want to exclude previously validated inputs you could use the touch
helper...
form.touch(['name', 'email', 'address']).validate()
@timacdonald thank you very much!!!
@makroxyz you can use the
form.touch
andform.touch
helpers to modify what is supposed to be validated.For example, when attempting to go to the next page you might do the following...
form.touch(['name', 'email', 'address']).validate()
This will validate all the fields, even if they have not been interacted with by the user.
If you want to exclude previously validated inputs you could use the
touch
helper...form.touch(['name', 'email', 'address']).validate()
Thank you! That was one of the things I wanted since I saw Laracon.
form.touch
has solved one issue for me, but how would I then run a callback function to wait until the form has finished validating the given fields?
For example my code is like this, but I need to wait until the validation has finished before emitting the event.
function nextStep() {
form.touch(["name", "email", "password", "password_validation"]).validate();
emit("next");
}
form.touch
has solved one issue for me, but how would I then run a callback function to wait until the form has finished validating the given fields?For example my code is like this, but I need to wait until the validation has finished before emitting the event.
function nextStep() { form.touch(["name", "email", "password", "password_validation"]).validate(); emit("next"); }
It would be great to know this, I also have this problem.
We will be adding the ability to detect individual validation responses. 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: () => /* .. */,
})"
/>
I'm using precognition form in a wizard. Every step has some properties of that form. I'd like, when press next, to validate only fields in the current step.
Is there a way to do it?