OnSubmit Catalog Client Script - Field Value Validation Reference and String
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2023 04:40 AM
I need help in validating the variables values which is device(reference field to cmdb_ci_computer ) and hostname( string value )before the form submission. If any of the variable value starts with "cpc" for the catalog item which has the catalog item category "aaa" , then alert message should be displayed and prevent the form submission.
These variables are in variable set , so i do not want to use reference qualifier.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2023 05:42 AM
can you try something like ..
if(variablename.startsWith('cpc){
alert("Your message");
return false // this will abort submission
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2023 05:45 AM
can you try something like ..
if(variable name.startsWith('cpc')){
alert(<your message>);
return false; //this will abort the submission
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2023 07:44 PM
I am able to achieve it for String. How to validate the value in Reference field.