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

disabledIf no longer works with multiple tests

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE

      Description

      Multiple disableIf depending on the same element does not work well in Moodle 2.2 (it's fine in Moodle 2.1)

      For example, assuming that I have a select box and a textbox

      $mform->addElement('select', 'select1', get_string('...', '...'), array(1, 2, 3, 4));
      $mform->addElement('text', 'text1', get_string('...', '...')_;

      I'd like to disable the text when select = 1 or 2

      $mform->disabledIf('text1', 'select1', 'eq', 1);
      $mform->disabledIf('text1', 'select1', 'eq', 2);

      In Moodle 2.2, just the first disabledIf command works. The second one is "hidden" by the first. Some debugging led me to the function convert_to_array in moodle_lib.php, the in_array condition eliminate the second rule so it doesn't appear in the json object passed to the javascript:

      Problem(s) described here: http://moodle.org/mod/forum/discuss.php?d=207045

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated: