How can I make a checkbox actually mandatory in service catalog?

santrym
Mega Expert

I have a checkbox that says "check this box if you agree to the policy terms...". I made the variable "mandatory", but I can still click "order now" even when the checkbox is not checked. How can I make it so you can only "order now" after the checkbox has been clicked?

1 ACCEPTED SOLUTION

getValue() return the value as string. Try this



function onSubmit() {


    //Type appropriate comment here, and begin script below SpaceIsThePlace


    if (g_form.getValue('PolicyAgreement')=='false') {



  g_form.showFieldMsg('PolicyAgreement', 'You must check the Policy Agreement checkbox', 'error');



  return false;


    }


}


View solution in original post

12 REPLIES 12

Dear Abhinay,


Dear Team,



I'm new in ServiceNow, can you share with me how to execute this script against the Checkbox field in the Request Form ??



Many thanks in advance


Best Regards


HI Khaled,



See Abhinay's script marked as the correct answer for inspiration.


Abhinay Erra
Giga Sage

Chuck is very generous. He loves helping poor people like me who only have 1/4 th of his total points.