Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form field not validated until other field is typed in #114

Open
Garima opened this issue Jul 16, 2018 · 1 comment
Open

Form field not validated until other field is typed in #114

Garima opened this issue Jul 16, 2018 · 1 comment

Comments

@Garima
Copy link

Garima commented Jul 16, 2018

I've a form field which has invalid data keyed in from backend.
On opening the form I put the valid data into the field,but it keeps giving me the invalid error until i type into other field.

What is the solution to it.

@wtho
Copy link

wtho commented Sep 16, 2018

What seems works is adding a ref to the html input and use
this.$ref.referenceToTheInput.dispatchEvent to notify Vue about the changes:

dispatchEvent('input') if the value was manipulated 'manually'
dispatchEvent('blur') if the input was not touched before by the user (to trigger validation)

Using both will trigger the vue-form-validation.

Note: I am not sure how good the browser support of dispatchEvent is and if this is considered a hack.

Don't forget to close the issue, if this solved your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants