From 90a1bde91519bfd3a7be45bbbcae9d6e3f4053a7 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Fri, 3 May 2024 15:22:49 +0530 Subject: [PATCH] Improved: added validations of character on Zipcodes(#255) --- src/components/FacilityAddressModal.vue | 8 +++++++- src/components/FacilityGeoPointModal.vue | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/components/FacilityAddressModal.vue b/src/components/FacilityAddressModal.vue index c105234e..3ce48bca 100644 --- a/src/components/FacilityAddressModal.vue +++ b/src/components/FacilityAddressModal.vue @@ -44,7 +44,7 @@ - +
{{ translate("Zipcode") }} *
@@ -149,6 +149,12 @@ export default defineComponent({ closeModal() { modalController.dismiss() }, + validateZipCode(e: any) { + if(/[`!@#$%^&*()_+=\\|,.<>?~{};:'"/]/.test(e.key)){ + e.preventDefault(); + return false; + } + }, async saveContact() { let resp, postalAddress = ''; diff --git a/src/components/FacilityGeoPointModal.vue b/src/components/FacilityGeoPointModal.vue index 0dce1322..1a0169a3 100644 --- a/src/components/FacilityGeoPointModal.vue +++ b/src/components/FacilityGeoPointModal.vue @@ -13,7 +13,7 @@
- + {{ translate("Generate") }} @@ -102,6 +102,12 @@ export default defineComponent({ closeModal() { modalController.dismiss() }, + validateZipCode(e: any) { + if(/[`!@#$%^&*()_+=\\|,.<>?~{};:'"/]/.test(e.key)){ + e.preventDefault(); + return false; + } + }, async generateLatLong() { if(!this.geoPoint.postalCode) { showToast("Please fill the required Zipcode")