CSR-1012 refactor hide alerts on text input

This commit is contained in:
Matt Caimi 2023-01-23 13:23:30 -05:00
parent a6e3c47aa9
commit a24be0cc1d
2 changed files with 12 additions and 4 deletions

View file

@ -70,7 +70,6 @@ export default {
questionAlignment: String, // Left or center. Left is default. questionAlignment: String, // Left or center. Left is default.
cornerStyle: String, // Rounded or square. Square is default. cornerStyle: String, // Rounded or square. Square is default.
includeSearchIcon: Boolean, includeSearchIcon: Boolean,
customOnChange: Function,
}, },
setup(props) { setup(props) {
const propsClone = Object.assign({}, props); const propsClone = Object.assign({}, props);
@ -146,7 +145,6 @@ export default {
}, },
watch: { watch: {
async value(newValue) { async value(newValue) {
this.customOnChange();
const result = await validate(newValue, this.validationRules); // do a test validation check, without triggering full validation const result = await validate(newValue, this.validationRules); // do a test validation check, without triggering full validation
if (result.valid) { if (result.valid) {
this.handleChange(newValue); // trigger full validation on this field only this.handleChange(newValue); // trigger full validation on this field only

View file

@ -19,6 +19,7 @@
<modal ref="zipCodeInputModal" :cmsWidgetName="this.modalWidgetName" :buttonClick="setZip"> <modal ref="zipCodeInputModal" :cmsWidgetName="this.modalWidgetName" :buttonClick="setZip">
<div class="ps-4 pe-4 pb-4"> <div class="ps-4 pe-4 pb-4">
<textboxQuestion <textboxQuestion
ref="zipInputTextQuestion"
:cmsWidgetName="this.textboxQuestionWidgetName" :cmsWidgetName="this.textboxQuestionWidgetName"
v-model="serviceZipCodeInput" v-model="serviceZipCodeInput"
inputId="serviceZipCodeInput" inputId="serviceZipCodeInput"
@ -26,8 +27,7 @@
mask="#####" mask="#####"
isRequired isRequired
disableAutoFill disableAutoFill
validationRules="zip-required|zip-format" validationRules="zip-required|zip-format" />
:customOnChange="this.resetsOnZipInput" />
<alert <alert
ref="alertInvalidZip" ref="alertInvalidZip"
v-if="displayInvalidZipAlert" v-if="displayInvalidZipAlert"
@ -145,6 +145,16 @@ export default {
return text; return text;
}, },
}, },
mounted() {
this.$watch(
() => {
return this.$refs.zipInputTextQuestion.value;
},
(val) => {
this.resetsOnZipInput();
}
);
},
components: { components: {
textLink, textLink,
modal, modal,