From 36fcc83f99cf85983c520624e70c33a04cd30d56 Mon Sep 17 00:00:00 2001 From: chaitaliKundu Date: Wed, 15 Oct 2025 22:57:50 +0530 Subject: [PATCH 1/2] README.md --- .../Catalog Client Script/Email & Phone Format/README.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Client-Side Components/Catalog Client Script/Email & Phone Format/README.md diff --git a/Client-Side Components/Catalog Client Script/Email & Phone Format/README.md b/Client-Side Components/Catalog Client Script/Email & Phone Format/README.md new file mode 100644 index 0000000000..9818dd3a7a --- /dev/null +++ b/Client-Side Components/Catalog Client Script/Email & Phone Format/README.md @@ -0,0 +1,4 @@ +# Contribution 3 + +My contribution is checking wheather email id format & mobile number format are correct or not during Catalog item Form Submission. Expected Email id Format - "abc12@gmail.com" & Expected Phone number Format - "123 -567 -6789" +If Format match system will allow to submit the Form or else restrict submission of the form. From 01e7c9f96eb21ff8305541835e9c2d85f045da11 Mon Sep 17 00:00:00 2001 From: chaitaliKundu Date: Wed, 15 Oct 2025 23:00:53 +0530 Subject: [PATCH 2/2] emailPhone.js --- .../Email & Phone Format/emailPhone.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Client-Side Components/Catalog Client Script/Email & Phone Format/emailPhone.js diff --git a/Client-Side Components/Catalog Client Script/Email & Phone Format/emailPhone.js b/Client-Side Components/Catalog Client Script/Email & Phone Format/emailPhone.js new file mode 100644 index 0000000000..2f96670cf5 --- /dev/null +++ b/Client-Side Components/Catalog Client Script/Email & Phone Format/emailPhone.js @@ -0,0 +1,24 @@ +//onSubmit catalog client script Form restriction +function onSubmit(){ +var phone = g_form.getValue('preffered_phone'); +var mail = g_form.getValue('email_details'); +var phnPattern = /^\d{3}-\d{3}-\d{4}/; +var mailPattern = /^[a-zA-Z0-9._%+1]+@(gmail\.com)$/; + +if( phone && !phone.match(phnPattern)) +{ + +alert("Phone number format is not correct"); +return false; +} +else if(mail && !mail.match(mailPattern)) + { +alert("Email format is not correct"); +return false; + } +else +{ + return true; +} + +}