How to make a group of checkboxes mandatory

dianeramos
Tera Contributor

I have a group of checkboxes i want to set as mandatory from the Form Design. I know from catalog item, adding a label and setting as mandatory will do the trick. Can I please get suggestions on how I can do this from a Form Design view?

Thank you

 

1 ACCEPTED SOLUTION

I've only ever used this as a Catalog Client Script rather than a Client Script; but that shouldn't really make a huge difference, other than where/when it runs.

View solution in original post

20 REPLIES 20

MrMuhammad
Giga Sage

Hi,

On the form we cannot make group of checkboxes mandatory. However, you can use on submit client script or Insert/update business rule to allow/restrict submission if all of the checkboxes are not checked and display the error message to the users. 

Hope that helps!

Regards,

Muhammad

Regards,
Muhammad

Thanks for the suggestion.

How can I make the client script say - when at least 1 check box is selected, allow submission?

You will need to create a flag that will turn to true if any of the checkboxes is checked, that can find by using if conditions 

something like this.

var flag = false;

if(checkbox1 == true)
  flag = true;
else if(checkbox2 == true)
  flag = true;
else if(checkox3 == true)
  flag = true;
.
.
.


if(flag == false)
  return false; //abort the submission as no checkbox is checked.

Please note, you can make the above code is just a sample. you can make that code more efficient and dynamic using the loops, arrays, or may be creating the system property and storing the checkboxes field names in there.

 

 

Regards,
Muhammad

Mario Quinones1
Mega Guru

You can have a UI policy that sets them as mandatory