Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.0.1
-
Fix Version/s: 2.0.3
-
Component/s: Forms Library, Repositories
-
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);