- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2019 12:42 PM
Hi,
PFB helpful links:
Hope this helps.
Mark helpful or correct based on impact.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2019 03:24 PM
Narendra, I tried the code from the article, it's not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2019 12:15 PM
Narendra,
I tried below onChange script, it worked,
function onChange(control, oldValue, newValue, isLoading) {
if(isLoading || newValue == ''){
return;
}
var pattern = /^\(\d{3}\)\s\d{3}-\d{4}$/; //(xxx) xxx-xxxx
var phone = g_form.getValue('emer_contact');
if(!pattern.test(phone)){
phone = phone.replace(/\D/g,'');
var regex = /^\d{10}$/;
var is_valid = regex.test(phone);
if(!is_valid){
g_form.addInfoMessage('Invalid phone number. Please enter 10 digits');
g_form.clearValue('emer_contact');
}else{
phone = '(' + phone.slice(0,3) + ') ' + phone.slice(3,6)+'-' + phone.slice(6,10);
g_form.setValue('emer_contact', phone);
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2020 10:22 AM
This worked well for me! Thank you very much for coming back and adding what you did! Makes community better!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2021 08:57 AM
Hello Nitish,
Thank you for uploading this script - It worked perfectly!
With kind regards,
Eamonn