Write mobile number validation : System should be allow only 10 digit mobile number
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2023 03:04 AM
Write mobile number validation : System should be allow only 10 digit mobile number If customer enter 9 digits or 11 digits(System should through Error Message on the form) Message is : Please enter 10 digit mobile number only
Labels:
- Labels:
-
service now
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2023 06:06 AM
Hello @praveenaaa
You need to write a onChange Client Script :-
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_field_name', '');
g_form.showFieldMsg('phone_number_field_name', 'Phone number should start with 0 and be 11 digits', "error");
}
}
Plz mark my solution as Accept, If you find it helpful.
Regards,
Samaksh