If No is selected from Yes/No variable, i want the submission to get cancelled

ravikiran0688
Tera Contributor

If No is selected from Yes/No variable, i want the submission to get cancelled

7 REPLIES 7

amlanpal
Kilo Sage

Hi Ravi,



If you are trying to achieve this via Client script, use below:


if (g_form.getValue('variable_name') == 'No') {


return false; }



If you are trying via Business rule, use below:


if (current.variables.variable_name == 'No') {


current.setAbortAction(true); }



I hope this helps.Please mark correct/helpful based on impact



Hi Amalan,


Thanks for the help, can we also get an alert on submission or when we change the value to "No"?


Regards,


Ravikiran


Hi Ravi,



My pleasure.


Yes, you can show alert message on your requirement as below. In that case you have to modify the code as below:


For Client script:


if (g_form.getValue('variable_name') == 'No') {


alert("Show your message here");


return false; }



For Business rule:


if (current.variables.variable_name == 'No') {


gs.addInfoMessage("Show your message here");


current.setAbortAction(true); }



I hope this helps.Please mark correct/helpful based on impact


This is not working for me on a Catalog Client Script.   My script:



function onSubmit(){




if (g_form.getValue('acknowledge')=='No'){


alert("You must agree to the acknowledgement");


return false;}          


}



I need to force a Yes from a yes/no or a checkbox for this form. Can you please help?