Reverted attempt at using 'eager' validation back to 'lazy' as it was displaying an error about the email format while the user was still entering their email address

This commit is contained in:
Leah Schumann 2022-05-04 15:13:17 -04:00
parent 1c43d00461
commit 16ff2001e5

View file

@ -2,10 +2,9 @@
<div class="textbox-question" :class="(errors && errors.length) || hasError ? 'has-error' : ''">
<label :for="inputId" :aria-label="questionText" class="form-label" v-html="labelText"></label>
<input
v-on="validationListeners"
v-model="value"
v-maska="mask"
:value="value"
@blur="value = $event.target.value"
:type="type"
class="form-control"
:ref="inputId"
@ -58,9 +57,7 @@ export default {
const fieldOptions = {
type: "text",
value: props.modelValue,
validateOnValueUpdate: false,
};
const {
errorMessage,
handleBlur,
@ -69,26 +66,6 @@ export default {
validate,
errors,
} = useField(props.inputId, props.validationRules, fieldOptions);
const validationListeners = computed(() => {
// If the field is valid or have not been validated yet
// lazy
if (!errorMessage.value) {
return {
blur: handleChange,
change: handleChange,
// disable `shouldValidate` to avoid validating on input
input: e => handleChange(e, false),
};
}
// Aggressive
return {
blur: handleChange,
change: handleChange,
input: handleChange, // only switched this
};
});
return {
errorMessage,
handleBlur,
@ -96,7 +73,6 @@ export default {
validate,
meta,
errors,
validationListeners
};
},
computed: {