[Feature Request] Validate a single field
See original GitHub issueProblem to solve
I need to just validate one of the fields in the form to do some processing like .validate('email')
to used to send a E-mail verification code in the register form.
According to the documentation, I used vee-validate
.But I encountered another problem: https://github.com/baianat/vee-validate/issues/2219
If vuetify has this feature, I don’t need to use other authentication components.It It took me too much time.
Proposed solution
<v-form ref="form">
<v-text-field label="E-mail" name="email">
</v-text-field>
<v-text-field label="Mobile" name="mobile">
</v-text-field>
<v-text-field label="Addr." name="address">
</v-text-field>
</v-form>
// single
$refs.form.validate('email')
// multiple
$refs.form.validate(['email', 'mobile'])
// All
$refs.form.validate() // existing
Issue Analytics
- State:
- Created 4 years ago
- Reactions:71
- Comments:6 (3 by maintainers)
Top Results From Across the Web
vue.js - how to validate both input fields when one updates
By default, a vuetify input's validation logic only triggers when the value bound to that input changes. In order to trigger the validation...
Read more >Validate a field only if another one passes validation - Laracasts
I have a form request that needs to validate 2 fields. However, I need to validate one of the fields only if the...
Read more >Validation - Laravel - The PHP Framework For Web Artisans
To learn about Laravel's powerful validation features, let's look at a complete example of validating a form and displaying the error messages back...
Read more >Field validation for forms | The Jotform Blog
Field validation is an automated process of ascertaining that each field contains the correct value before the form is accepted. The concept is ......
Read more >How to validate a field in a Service Request - Ivanti Community
2, it is not possible to add a validation rule in a Request Offering template field configuration. This article describes how to add...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have another case where this feature would be useful.
In the case where we have 2 input fields for dates (lets say the first is StartDate and the second is EndDate). There is a common validation practice to ensure that the StartDate is always after the EndDate. Well, in the case of Vue, if the user triggers validation on both (which is not usual, but can happen when someone is not paying attention), fixing the first field will not remove the validation error on the second. The only way to resolve this is to instruct the user to change the second input field so a revalidation occurs. It would be better if we could invoke an individual validation on the second fields when the first passes validation.
Alternatively, I suggest a method that will clear an error for a specific field. So in this scenario, when one of the dates passes validation, we could clear the error on the second. This approach poses other issue such as follow-on validation that might have other validation issues.
One thing to note, there is the potential reclusiveness as we’ve experienced when invoking the current validate method. I am open to better ideas and suggestions.
resolved by #14026
Vuetify 3 validation is lazy by default now. You can use a ref on the input to manually validate it.
You also have access to a
v-validation
component which provides you with more flexibility:If you have any questions, please reach out to us in our Discord community.