'Update input value after validation

I’m new to Vue.

I would like to know if it is possible to update the input value after running a custom validation in Vuelidate. I have an input field for postcode. I want to return the postcode with the correct format in case the user forgets to put a whitespace, and update the input field with the correct value, e.g.

user input = XXXXXX
returned output = XXX XXX

Sample 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;
      }
    }
  }
  ...
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source