Prevent Catalog Item from Being Submitted If

TStark
Kilo Sage

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

1 ACCEPTED SOLUTION

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

View solution in original post

5 REPLIES 5

Raghu Ram Y
Kilo Sage

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;
        }
    }