- 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
‎09-10-2020 10:12 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2020 10:28 AM
Use below regex
^([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:02 AM
Let me know if this works for you 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2020 11:04 AM
Use the following regex:
function onSubmit(){
var mobileno=g_form.getValue("field name");//enter appropriate field name
var regex="^0\d{10}";
if(!regex.test(mobileno){
g_form.addInfoMessage("Please enter a valid no");
g_form.clearValue("field name");//enter appropriate field name
g_form.getControl("field name").focus();//enter appropriate field name
return false;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2020 11:09 AM
I already gave that exact same regex.