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

disabledIf no longer works with multiple tests

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 2.2, 2.3
    • Forms Library
    • MOODLE_22_STABLE, MOODLE_23_STABLE

      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

            moodle.com Moodle HQ
            ravenink Luis de la Torre
            Votes:
            3 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.