Skip to content

Commit 72c097a

Browse files
authored
Validates a 10-digit fax number and rejects any input that isn’t exactly 10 digits. (#1974)
* Create Allow 10digit Fax Number.js * Create README.md
1 parent baba67c commit 72c097a

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
function onChange(control, oldValue, newValue, isLoading) {
2+
if (isLoading || newValue == '') {
3+
return;
4+
}
5+
6+
var faxRegex = /^\d{10}$/; //allow only 10 digit in fax number field
7+
if (!faxRegex.test(newValue)) {
8+
g_form.addErrorMessage('Please enter a valid 10-digit fax number');
9+
g_form.clearValue('fax_num');
10+
}
11+
12+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This script ensures that the fax number entered consists of exactly 10 digits.
2+
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.

0 commit comments

Comments
 (0)