How to validate field after formatting field on blur. #3309
-
Thanks for great library! However, this library try to validate the field before blur event. and then blur event occurs. Example code: <Field name="credit-card-number" rules="required|cardNumber" v-slot="{ field, errors }">
<input type="tel" v-bind="field" :value="cardNumber" @blur="formatCardNumber">
</Field> formatCardNumber method will format and updates cardNumber prop |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I achieved it by disabling validate on blur with |
Beta Was this translation helpful? Give feedback.
I achieved it by disabling validate on blur with
:validateOnBlur="false"
on field that need to be formatted on blur event.and call
await validate()
which can get from useField hook after formatting field in formatCardNumber method.Although I don't know this method is right way so I am waiting for your answer.