Text box should start with '_'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2016 04:57 AM
Hi All,
I have a requirement of placing a validation in the text box,
It should start with '_A' , If not it should throw as error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2016 05:52 AM
Hi,
Can you please help me with the script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2016 06:05 AM
Try below in onChange catalog client script.
Also check below blog for better understanding:-
Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.
------------------------------------------------------------------------
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var regexp = /^_a.*$/;
// alert(regexp.test(newValue));
if(!regexp.test(newValue)){
alert("It should start with _A");
g_form.setValue('u_impacted_users', '');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2016 06:30 AM
Hi Mohammed,
Can you mark my reply as helpful/correct since the regular expression for validation was shared in the question from my end.
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
10-05-2016 06:35 AM
ya thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2016 06:23 AM
Is it solved? if yes pls mark Correct to close the thread and make it helpful for others who have same issue in future.
You can find correct option by clicking on below link.
Text box should start with '_'