diff --git a/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue b/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue index ac42fce2e..deff594e5 100644 --- a/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue +++ b/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue @@ -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(); } } }, diff --git a/src/layouts/payment-method/promo-modal-question/promo-question/promo-question.vue b/src/layouts/payment-method/promo-modal-question/promo-question/promo-question.vue index 25744e652..053e8eedc 100644 --- a/src/layouts/payment-method/promo-modal-question/promo-question/promo-question.vue +++ b/src/layouts/payment-method/promo-modal-question/promo-question/promo-question.vue @@ -8,6 +8,7 @@ cornerStyle="rounded" :displayQuestionText="false" isRequired + @input="validateAlphanumeric" validationRules="promo-required" /> @@ -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, },