Validate multiple email id's in single line text field seperated by commas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2022 02:48 AM - edited ‎11-16-2022 02:49 AM
We are using the below on change client script to validate multiple email address seperated by comma in single line text field name 'cc_email_addresses', But it is throwing error 'There is a javascript error in your browser console'. Please let me know if anyone having any idea if we have to make any changes in any part of the script.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var err_field = control.id;
var err_flag = true;
var err_message = 'Invalid Email Address';
g_form.hideErrorBox(err_field);
var group_members = g_form.getValue('cc_email_addresses');
var member_split = group_members.split(',');
for (var n = 0; n < member_split.length; n++) {
var member_info = member_split[n].trim();
regex = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/i;
err_flag = regex.test(member_info);
if (!err_flag) {
break;
}
}
if (!err_flag) {
g_form.hideFieldMsg('req_inbox');
g_form.showFieldMsg(err_field, err_message, 'error');
} else {
g_form.hideErrorBox(err_field);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2022 02:57 AM
Hello, is it catalog client script and error os on the portal of yes generally it happens when you use a syntax which is not aupported in the portal.
Bte in hour code what is the purpose of g_form.hideErrorBox(err_field) tey to remove it from the vide and then try can you check and let me know
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2022 05:12 AM
I removed g_form.hideErrorBox(err_field); but still the same error it seems. Please let me know if there is any other script or enhancement needs to be done in this script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2024 11:05 PM
function onChange(control, oldValue, newValue, isLoading) {
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2024 11:06 PM
You can use below script: