- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2019 09:47 AM
I have field called folder. where i have to allow only
x:\folder or
x:\\folder or
x:\folder\folder\ or
x:\\folder\folder or
x:\\folder\\folder etc etc
Can i anyone help me with onchange client scipt for this ? I Have tried below code, but getting accurate result..
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var regExp1 = /\\[a-z]+\\[a-z]+$/i;
var isValid1 = regExp1.test(newValue);
if(!isValid1) {
g_form.addErrorMessage("Enter proper path");
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2019 06:41 PM
Try this instead
/^([a-zA-Z]:)*\\+(\w+\\+)*\w*$/.test(yourString);
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2019 10:43 PM
yeah
Thanks for the help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2021 09:54 AM
i have tried same it is not working for me.
Could you please paste your code which it worked for you