- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2022 06:41 AM
Is there a way to prevent a catalog item form (portal) from being submitted if a certain choice value is selected in a variable select box?
Thanks,
AJ
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2022 07:14 AM
It depends on the values for the choices.
If you can go to the form, right click the Banks field and select 'Configure choices' you will see the Values for each of the choices.
Lets say that the value for Chase is: chase
and the value for TD Bank is: td_bank
function onSubmit() {
if(g_form.getValue('u_banks') == 'chase' || g_form.getValue('u_banks') == 'td_bank'){ //change u_banks with the name of your field
g_form.addErrorMessage('Request was not created'); //change with your message
//Make sure dirty form still works
g_form.submitted = false;
//Abort the submission
return false;
}
}
Replace the 'u_banks', 'chase', td_bank' with their actual names.
Please mark my answer as Correct/Helpful based on impact
Regards,
Dan H
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2022 07:20 AM
Hi,
Create on submit client script and use the below code.. tested.. working
function onSubmit() {
var getValue = g_form.getValue('fieldname');
if (getValue == 'choice 1' || getValue == 'choice 2') {
g_form.addErrorMessage('write the error message);
return false;
}
}