Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
@@ -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;
}

}
Loading