OnSubmit Catalog Client Script - Field Value Validation Reference and String

chandrashobana
Giga Expert

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. 

3 REPLIES 3

Ruchi Kumari1
Tera Expert

can you try something like ..
if(variablename.startsWith('cpc){

alert("Your message");

return false // this will abort submission

}

Ruchi Kumari1
Tera Expert

can you try something like ..

if(variable name.startsWith('cpc')){

 

alert(<your message>);

return false; //this will abort the submission

 

}

chandrashobana
Giga Expert

I am able to achieve it for String. How to validate the value in Reference field.