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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 2.3.1
    • None
    • Forms Library
    • MOODLE_23_STABLE

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              moodle.com moodle.com
              daniss Daniele Cordella
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: