- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2019 07:14 AM
How to restrict numeric and special characters and allowing rules- only alphabets and _(under score) only ? please help me, we have project requirement.
Thanks,
Ram
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2019 07:43 AM
Hi Ram,
so only alphabets a to z lowercase and A to Z uppercase and only 1 special character i.e. underscore is allowed.
use this script in client side
I believe this you want in onchange client script
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(!/^[a-zA-Z_]+$/i.test(newValue)){
alert('Please enter only upper/lower case alphanumeric & underscore character');
g_form.clearValue('fieldName');
}
}
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2019 07:43 AM
Hi Ram,
so only alphabets a to z lowercase and A to Z uppercase and only 1 special character i.e. underscore is allowed.
use this script in client side
I believe this you want in onchange client script
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(!/^[a-zA-Z_]+$/i.test(newValue)){
alert('Please enter only upper/lower case alphanumeric & underscore character');
g_form.clearValue('fieldName');
}
}
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2019 06:29 AM
Hi Ram,
Can you also mark my answer as helpful.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader