Service Catalog accepts only alphanumeric values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2016 12:58 PM
I need a client script that accepts alphanumeric, excluding special characters and 'na' 'n/a' 'None'. I have single line text box to that field. Please anyone help me with this.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2016 01:08 PM
Hi Manoj,
Are you familiar with regular expressions? You can accomplish this through regular expressions.
The following should be helpful:
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2016 01:23 PM
Thanks for your response. I am new here and pretty not sure about scripting.
Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2016 01:27 PM
Hi Manoj,
You are welcome. If you are unfamiliar with scripting, check out developer.service-now.com. We also have courses available. In the mean time, consider parking some of these requirements that require scripting until you, or someone on your staff, can fully support them.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2016 01:12 PM
Hi Kumar,
Your script would look something like this (assuming your field is not called yourField, adjust as needed)
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
g_form.hideFieldMsg('yourfField');
var patt = "^[a-zA-Z0-9]*$";
if (!patt.test(newValue))
g_form.showFieldMsg('yourField', 'Invalid input', 'error');
var patt2 = "^[Nn]/[Aa]$";
if (!patt.test(newValue))
g_form.showFieldMsg('yourField', 'Invalid input', 'error');
}