I am just getting started with Vue.
I am curious to know if it is possible to automatically update the input value after performing custom validation in Vuelidate. For example, I have an input field for a postcode and I would like to format it correctly if the user forgets to include a whitespace, updating the input field with the proper value, like this:
User input = XXXXXX
Returned output = XXX XXX
Here is a snippet of my code
export default {
...
validations: {
postcode: {
required,
maxLength: maxLength(10),
validatePostcode: (value) => {
const result = customValidators.validatePostcode(value);
if (result !== false) {
if (result !== value) {
// UPDATE THE INPUT VALUE HERE WITH THE CORRECT POSTCODE FORMAT
}
return true;
}
return false;
}
}
}
...
}