Selecting at least one checkbox out of given 4


How can I post Multiple Choice Questions in HRMS?

actually I made a DocType for this and made a complete form which takes a question with its 4 options and below 4 options there are 4 checkboxes for “Is This Option Correct?”

but, the user can select multiple option or, user can leave without selecting any checkbox.

I want to ensure that user must select at least 1 option from the given 4.

Can you please help me with it?

edit: I have attached a screenshot for your understanding.

Hi @harshvadhiya,

You can add validation using client script or server script.

Syntax like:

frappe.ui.form.on('YourDocType', {
    validate: function(frm) {
        // Check if at least one checkbox is checked
        if (!(frm.doc.checkbox_field_1 || frm.doc.checkbox_field_2 || frm.doc.checkbox_field_3 || frm.doc.checkbox_field_4)) {
            frappe.msgprint(__("Please select at least one option."));
            validated = false; // Prevent form save/submit

Please set your doctype, and field name in the script according to the scenario.

Thank You!

1 Like