Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-34760

$mform->disabledIf is not working when the parent item is a checkbox group

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 2.3.1
    • Forms Library
    • MOODLE_23_STABLE

      Using the attached moodle form I tried to disable the second mform element (the select) IF AND ONLY IF the selection in the checkbox element is:

      Spain: checked
      France: not checked
      Germany: not checked
      Italy: checked

      I tried few ways to call the disabledif method but never with success.

      Using:

          $mform->disabledIf('secondformelement', 'firstformelement_1', 'notchecked');
          $mform->disabledIf('secondformelement', 'firstformelement_2', 'eq', 1);
          $mform->disabledIf('secondformelement', 'firstformelement_3', 'eq', 1);
          $mform->disabledIf('secondformelement', 'firstformelement_4', 'notchecked');


      and looking at the html code I only found:

      Y.on('domready', function() {
          Y.use('mform', function(Y) { 
              M.form.initFormDependencies(Y, "mform1", {
                  "firstformelement_1":{
                      "notchecked":{
                          "1":["secondformelement"]
                      }
                  },
                  "firstformelement_2":{
                      "eq":{
                          "1":["secondformelement"]
                      }
                  }
              });
          });
      });

      without any reference to firstformelement_3 and firstformelement_4.

            moodle.com Moodle HQ
            daniss Daniele Cordella
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.