-
Bug
-
Resolution: Fixed
-
Major
-
2.0.1
-
MOODLE_20_STABLE
-
MOODLE_20_STABLE
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);