- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2020 09:55 AM
-
Create any sample table and create sample field mobile no and when user try to submit record following condition should met :
-
Mobile no should be 11 digit no and must start with 0 always, and should be a valid Indian number. Then submission should work
-
If conditions fails record should not be submitted.
I want to run client script for this , can anyone help me out? I want the code which i should run to fulfill my req.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2020 10:53 AM
Use Variable Validation Regex like so:
The regular expression:
^[0]\d{10}
You can add the validation to a variable like this:
Or if not in the catalog, you can use an onChange CLient script on the 'phone_number' field:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var reg = /^[0]\d{10}/;
if (!reg.test(newValue)) {
g_form.setValue('phone_number', '');
g_form.showFieldMsg('phone_number', 'Phone number should start with 0 and be 11 digits', "error");
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2020 10:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2020 10:53 AM
Use Variable Validation Regex like so:
The regular expression:
^[0]\d{10}
You can add the validation to a variable like this:
Or if not in the catalog, you can use an onChange CLient script on the 'phone_number' field:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var reg = /^[0]\d{10}/;
if (!reg.test(newValue)) {
g_form.setValue('phone_number', '');
g_form.showFieldMsg('phone_number', 'Phone number should start with 0 and be 11 digits', "error");
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2020 09:55 AM
Hi thanks for the reply to my question.
But what if my req is that it should take only 10 digits and should start with 9.
Than what changes needs to be done in the code given from your side?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2020 10:00 AM
Use below regex for mobile number validation as per your format.
^([0|\+[0-9]{1,5})?([7-9][0-9]{9})$
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2020 10:01 AM
^[9]\d{9}