Block submitting form after choosing specific form option

AdamUMC
Giga Guru

Hi,

I have a probably simple question: Is it possible to disable the possibility to sent/submit forms, after choosing a specific form option in the form itself?

Thanks!

1 ACCEPTED SOLUTION

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

You can write a onsubmit script which will have the logic that if the chosen option is the one we just return false and the user is not able to submit the form.

 

The script will look something like below:-

 

function onSubmit(){
   var mandatoryVar = g_form.getValue('fieldname');
   if (mandatoryVar =="optionwewanttostopfor"){
      alert("You cannot submit for this option");
   return false; }
}

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0622896

 

Please mark my answer as correct based on Impact. 

View solution in original post

5 REPLIES 5

AdamUMC
Giga Guru

Thank you all! This works very well!