vue-form icon indicating copy to clipboard operation
vue-form copied to clipboard

Form field not validated until other field is typed in

Open Garima opened this issue 5 years ago • 1 comments

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.

Garima avatar Jul 16 '18 06:07 Garima

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.

wtho avatar Sep 16 '18 10:09 wtho