Variable data validation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2016 11:14 AM
Hey There Community!
Trying to do something that seems pretty straight forward but having a hard time finding the best mechanism to achieve this.
We have a requested item in our service catalog in which we'd like to do some data validation on.
When users fill out the variables in the form, one of them should require that it be a 15 digit number and not allow the user to proceed until that one field meets the requirements.
Hoping to get some feedback on what people have done to achieve a similar goal.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2016 12:25 PM
Since your goal is to run the script in the Service Catalog, you actually wouldn't specify a table in the client script. Regular client scripts are stored in the Client Script table (sys_script_client), but client scripts running in the Service Catalog are actually stored on a child table of sys_script_client called Catalog Client Scripts (sys_script_client).
You can either go to the Catalog Client Scripts module and click 'new', or the quicker method that I prefer is just VIA the context menu when you are viewing the Item you want to add the script to; "Configure Catalog Client Scripts".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2016 12:33 PM
Thanks Simon, this was super helpful!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2017 12:45 PM
I try this code to validate a port number:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(/\D/g.test(newValue)==false){
if(newValue <= 65536){
//Valid
}
else{
g_form.setValue('port_number0','');
alert("Invalid port number");
}
}
else{
g_form.setValue('port_number0','');
alert("Only digits allowed");
}
}
And it works fine