diff --git a/Client-Side Components/Catalog Client Script/Allow 10digit Fax Number/Allow 10digit Fax Number.js b/Client-Side Components/Catalog Client Script/Allow 10digit Fax Number/Allow 10digit Fax Number.js new file mode 100644 index 0000000000..95f5371773 --- /dev/null +++ b/Client-Side Components/Catalog Client Script/Allow 10digit Fax Number/Allow 10digit Fax Number.js @@ -0,0 +1,12 @@ +function onChange(control, oldValue, newValue, isLoading) { + if (isLoading || newValue == '') { + return; + } + + var faxRegex = /^\d{10}$/; //allow only 10 digit in fax number field + if (!faxRegex.test(newValue)) { + g_form.addErrorMessage('Please enter a valid 10-digit fax number'); + g_form.clearValue('fax_num'); + } + +} diff --git a/Client-Side Components/Catalog Client Script/Allow 10digit Fax Number/README.md b/Client-Side Components/Catalog Client Script/Allow 10digit Fax Number/README.md new file mode 100644 index 0000000000..c896360bac --- /dev/null +++ b/Client-Side Components/Catalog Client Script/Allow 10digit Fax Number/README.md @@ -0,0 +1,2 @@ +This script ensures that the fax number entered consists of exactly 10 digits. +Any input that doesn’t meet this requirement — such as numbers with fewer or more digits, letters, or special characters — will be automatically rejected to maintain proper validation and data consistency.