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 {
|
} else {
|
||||||
if (promoCodeData.errorCode == promoErrorCodes.PROMO_STACKING_NOT_ALLOWED) {
|
if (promoCodeData.errorCode == promoErrorCodes.PROMO_STACKING_NOT_ALLOWED) {
|
||||||
this.displayInvalidOnOrderPromoAlert = true;
|
this.displayInvalidOnOrderPromoAlert = true;
|
||||||
this.focusOnPromoInput();
|
|
||||||
this.resetModalButtonStyle();
|
|
||||||
} else {
|
} else {
|
||||||
this.displayInvalidPromoAlert = true;
|
this.displayInvalidPromoAlert = true;
|
||||||
this.focusOnPromoInput();
|
|
||||||
this.resetModalButtonStyle();
|
|
||||||
}
|
}
|
||||||
|
this.focusOnPromoInput();
|
||||||
|
this.resetModalButtonStyle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
cornerStyle="rounded"
|
cornerStyle="rounded"
|
||||||
:displayQuestionText="false"
|
:displayQuestionText="false"
|
||||||
isRequired
|
isRequired
|
||||||
|
@input="validateAlphanumeric"
|
||||||
validationRules="promo-required" />
|
validationRules="promo-required" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -22,6 +23,8 @@ import { errorMessages } from "@/constants/error-messages";
|
||||||
// Define Validation Rules
|
// Define Validation Rules
|
||||||
defineRule("promo-required", required(errorMessages.PROMO_REQUIRED));
|
defineRule("promo-required", required(errorMessages.PROMO_REQUIRED));
|
||||||
|
|
||||||
|
const ALPHANUMERIC_REGEX = /[^a-zA-Z0-9]/g;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "promo-question",
|
name: "promo-question",
|
||||||
props: {
|
props: {
|
||||||
|
|
@ -38,6 +41,11 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
validateAlphanumeric() {
|
||||||
|
this.value = this.value.replace(ALPHANUMERIC_REGEX, "");
|
||||||
|
},
|
||||||
|
},
|
||||||
components: {
|
components: {
|
||||||
textboxQuestion,
|
textboxQuestion,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue