Merge pull request #1529 from Safelite/feature/CSR-1393.1
validate alphanumeric values
This commit is contained in:
commit
2e159ef37f
2 changed files with 10 additions and 4 deletions
|
|
@ -217,13 +217,11 @@ export default {
|
|||
} else {
|
||||
if (promoCodeData.errorCode == promoErrorCodes.PROMO_STACKING_NOT_ALLOWED) {
|
||||
this.displayInvalidOnOrderPromoAlert = true;
|
||||
this.focusOnPromoInput();
|
||||
this.resetModalButtonStyle();
|
||||
} else {
|
||||
this.displayInvalidPromoAlert = true;
|
||||
this.focusOnPromoInput();
|
||||
this.resetModalButtonStyle();
|
||||
}
|
||||
this.focusOnPromoInput();
|
||||
this.resetModalButtonStyle();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
cornerStyle="rounded"
|
||||
:displayQuestionText="false"
|
||||
isRequired
|
||||
@input="validateAlphanumeric"
|
||||
validationRules="promo-required" />
|
||||
</template>
|
||||
|
||||
|
|
@ -22,6 +23,8 @@ import { errorMessages } from "@/constants/error-messages";
|
|||
// Define Validation Rules
|
||||
defineRule("promo-required", required(errorMessages.PROMO_REQUIRED));
|
||||
|
||||
const ALPHANUMERIC_REGEX = /[^a-zA-Z0-9]/g;
|
||||
|
||||
export default {
|
||||
name: "promo-question",
|
||||
props: {
|
||||
|
|
@ -38,6 +41,11 @@ export default {
|
|||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
validateAlphanumeric() {
|
||||
this.value = this.value.replace(ALPHANUMERIC_REGEX, "");
|
||||
},
|
||||
},
|
||||
components: {
|
||||
textboxQuestion,
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue