-
Bug
-
Resolution: Not a bug
-
Minor
-
None
-
3.10
-
MOODLE_310_STABLE
Given the following form:
<?php
|
require_once 'config.php'; |
require_once $CFG->dirroot . '/lib/formslib.php'; |
class myform extends moodleform { |
|
public function definition() |
{
|
$this->_form->addGroup([ |
$this->_form->createElement('advcheckbox', 'c1', 'off'), |
$this->_form->createElement('text', 't1'), |
$this->_form->createElement('date_selector', 'd1'), |
], 'group'); |
|
$this->_form->addElement('date_selector', 'd2'); |
|
$this->_form->disabledIf('group[t1]', 'group[c1]', 'checked'); |
$this->_form->disabledIf('group[d1]', 'group[c1]', 'checked'); |
$this->_form->disabledIf('d2', 'group[c1]', 'checked'); |
|
$this->add_action_buttons(); |
}
|
|
}
|
|
$PAGE->set_url(new moodle_url($_SERVER['REQUEST_URI'])); |
$PAGE->set_context(context_system::instance());
|
|
$page = optional_param('page', 'index', PARAM_TEXT); |
|
echo $OUTPUT->header();
|
|
$form = new myform(); |
$form->display();
|
|
echo $OUTPUT->footer();
|
Expected
When I click the 'off' (c1) checkbox, the 3 fields (t1, d1 and d2) should all be disabled.
Actual
The t1 and d2 are disabled, but d1 is not (the date_selector inside the group).
It seems that there is some problem presumably finding the element id, as the date_selector uses a group itself, so perhaps being a group inside a group is causing problems?
I'm not sure if this a bug, or if I can resolve this by changing the `disabledIf` call in some way?
- has been marked as being related by
-
MDL-83631 Checkbox "Enabled" in the date form field inside a group does not actually enable/disable the date input
-
- Open
-