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-10-2017 05:49 PM
Hi Tom,
Is there any possibility to create a macro. I have multiple fields that need this functionality. Please Advise.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-10-2017 08:51 PM
You can declare function in onLoad client script and access in onChange client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-10-2017 07:27 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-10-2017 09:21 PM
Hi Asit,
Can you please try below script:
Declare isAllLetter function in onLoad client script and call this function in onChange client script :
function onLoad() {
//Type appropriate comment here, and begin script below
}
function isAllLetter(inputtxt)
{
var letters = /^[a-zA-Z0-9]*$/;
if(inputtxt.toLowerCase() !='na' && inputtxt.toLowerCase() !='n/a' && inputtxt.toLowerCase() !='none' && inputtxt.match(letters))
return true;
else
return false;
}
onChange Client script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
g_form.hideFieldMsg('fieldName');
if(!isAllLetter(newValue.trim()))
g_form.showFieldMsg('fieldName', 'Invalid input', 'error');
else
g_form.hideFieldMsg('fieldName');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-10-2017 09:21 PM
or you can directly use function script in your onChange client.