Can you make a field required through script in Service Catalog form? I know the normal way to make a field required is on the form but if a field needs to be conditionally required can you make it required using a script?
Release : 17.3
Component : Catalog - Request Creation
You would need to create a function to validate that the field is not empty. If it's empty, then you can show an alert and return false and it won't allow you to continue. If it's not empty, you can call another function, return true and continue with the ticket creation.
Here is an example :
if(ca_fdIsSelectRadio(formId, "fieldname", "No")){
if (user == "");
alert("Requested For cannot be blank");
return false;
} else {
alert('else no');
return true;
}
if(ca_fdIsSelectRadio(formId, "fieldname", "Yes")){
if (auserid == "");
return false;
} else {
alert('else yes');
return true;
}
}