How can you create a multiple choice check box and make it mandatory?

pagdenl
Giga Expert

I am trying to find a way to create a multiple choice check box, without using a label.   I need to make the question mandatory, but by using a label and creating check boxes, mandatory does work correctly, and customer cannot submit the catalog item. Do I need to script this or is there any other solution??

From the Wiki:

Displays a label across the form. Use labels to separate questions into sections (example, left) or list check boxes in order under a label to create a question for which the user can select several options (example, check boxes). Mandatory and Read only UI policies don't apply to this variable type.


Creates a check box that may be selected or cleared. List check boxes in order under a label to create a multi-option question (as shown in the example).

1 ACCEPTED SOLUTION

DaSmith9
Tera Expert

Hi Denise, I had a similar scenario and came across your post and saw it was never answered (even after a couple of years). I believe I found the answer in another post that I hope satisfies the original requirement so that you and any others who come across this post will know how to make this work.

 

 

 

Catalog Item Sleight of Hand: Mandatory selection of Checkbox options without writing scripts

 

 

 

This posting describes how to create the label/checkbox options, and then also how to create the appropriate UI Policy to ensure the label/options are mandatory for one or more options to be selected.

 

 

 

A couple of things to note regarding this solution.

 

  • It also works if you put a container start, container split and container end for your options if you prefer them to be on two columns
  • Be sure when you are creating the UI policy, be sure that you are using AND, and not OR for the policy conditions
  • I have validated this works as of Helsinki

 

 

Best part is, no script required Thanks Mike for the solution mike.pryor

 

View solution in original post

20 REPLIES 20

pagdenl
Giga Expert

I meant to say mandatory does not work correctly.


Brad Tilton
ServiceNow Employee
ServiceNow Employee

Do you want a multiple choice (where they can only choose one asnwer = radio buttons) or multiple checkboxes? With a multiple choice you can just adda   none value and make it mandatory.



I would check this out if you're talking checkboxes:


http://www.servicenowguru.com/scripting/client-scripts-scripting/checkbox-variables-mandatory/


Thank you Brad, yes I would like to create multiple checkboxes (they can pick more than one), let me try this out and will get back to you. Thanks Again.



Thanks,



Denise


Phone: (208) 331-7238


System Administrator, ServiceNow


Blue Cross of Idaho.


Hello,


This script does not work in Geneva. We use two scripts - onLoad and onSubmit. What I learned today is that (this non-working) onLoad script prevent execution of new UI policy on the same catalog item. Immediately I inactivated onLoad script, my UI policy works just fine. OnSubmit script works fine too


Is there any workaround?