- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 04:36 AM
Hi Team,
I am trying to create a variable which should accept only email. How can i achieve this without writing an acl?
BR,
AtchutRam
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 04:48 AM - edited 02-26-2024 04:58 AM
Hi @Atchutaram ,
If you are trying for any field or variable in catalog item then you can use validation regex,
If for a field inside table , then you can write onchange client script as below,
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var mail = /^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/;
if (!newValue.match(mail)) {
alert('You have entered an invalid email address format! example: example@gmail.com' );
g_form.clearValue('field_backend_name');
}
}
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 04:45 AM - edited 02-26-2024 04:56 AM
Hi @Atchutaram .
Create variable of type 'Email'
if that also not resolving your issue , create one single line text type variable and add validation regex as Email like below
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 04:48 AM - edited 02-26-2024 04:58 AM
Hi @Atchutaram ,
If you are trying for any field or variable in catalog item then you can use validation regex,
If for a field inside table , then you can write onchange client script as below,
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var mail = /^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/;
if (!newValue.match(mail)) {
alert('You have entered an invalid email address format! example: example@gmail.com' );
g_form.clearValue('field_backend_name');
}
}
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 04:59 AM
Hello @Atchutaram
Please refer the below articles: -
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Abhishek Rai