31
Views
8
Comments
Make mandatory
Question
Application Type
Reactive

Hi, 

I have a question and it has a checkbox. Can I make this question as mandatory?

Could you add an image as an example of this dropdown/checkbox look?

Within the widget properties you can set Mandatory to True, and additionally you can check during sending/saving the form if the checkbox/question is selected/filled in.

Normally, Check box has 2 values : true or false. So even if the user selects or not, it takes any of the values. So I guess for this reason, mandatory field does not come into matter. But I'm little bit confused.

Then you have some options to go for (there are even other options, but these should at least give you some ideas on how to solve it):

  • a buttongroup with 'yes', 'no', 'none' and with the validation you check if anything other than 'none' is selected
  • two checkboxes, both unchecked. When one is checked, uncheck the other. In validation you search for one of the checkboxes is checked.
  • a dropdown with an empty value (or a "- please select -") and the values 'yes' and 'no', validating that at least either 'yes' or 'no' is selected

Using Radiobuttons with a group of 2 items (Yes or No) could be an alternative.

You can make the radiobuttons mandatory and still have a similar result

Champion

Hi @Gayathri Gali 

Instead of checkbox you should  use radio button as there are more option then checkbox.

Best

Arun

Champion

@Gayathri Gali  Hi,

Are you sure the checkbox is at the question level and not at the answers to the question, having one checkbox for each answer? 

I'm asking this because the requirement seems strange. If you want to make a checkbox mandatory you are forcing the user to select it. So if that's the case you can simply check for when the boolean variable bound to the checkbox holds the value True (assuming the checkbox starts as false/deselected). When it holds the value true, you let the user continue as he already clicked it, otherwise you throw the mandatory message.

Although again, I repeat, this is a very strange requirement, please provide more info regarding the meaning of what you're trying to accomplish so we can help!


Cheers,

Paulo

Or, you could work with a tri-boolean value:

Create a static entity with the values 'None', 'True', 'False'

Let the default be 'None' and check whether the value has changed to either 'True' or 'False'.

You can do even easier value selection and validation with this option.

You can use this entity with earlier mentioned options (even a button or radiobutton group, where you have two choices being the True and False, not showing the None)

Hey,

you want to make check box mandatory that means you are forcing the user to tick the check box.So don't use check box take directly true as your input.

Thanks & Regards,

Sudip Pal

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.