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

disabledIf doesn't work on filepicker form elements

    Details

    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      The nifty Javascript that $mform->disabledIf() uses to switch form elements to "disabled" doesn't work with a filepicker element. Sample code:

      // ... in a form definition
      $mform->addElement('select','enabler','Enable other form elements?', array(0=>'No',1=>'Yes'));

      // A text field will enable/disable properly
      $mform->addElement('text','foo','This is a text field');
      $mform->disabledIf('foo','enabler','neq',1);

      // A filepicker will remain enabled no matter what
      $filemanager_options = array();
      $filemanager_options['return_types'] = 3;
      $filemanager_options['accepted_types'] = 'web_image';
      $filemanager_options['maxbytes'] = get_max_upload_file_size($CFG->maxbytes);
      $mform->addElement('filepicker', 'bar', 'This is a filepicker', null, $filemanager_options);
      $mform->disabledIf('bar','enabler','neq',1);

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  1 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    5/May/11