MDL-71336 forms: ensure grouped date elements have unique IDs.

Previously they were each taking the ID of their parent group element.
This commit is contained in:
Paul Holden
2023-11-23 12:01:24 +00:00
parent b58d1fd4e2
commit b7205c5c84
5 changed files with 24 additions and 13 deletions
+3 -2
View File
@@ -130,11 +130,12 @@ class MoodleQuickForm_date_selector extends MoodleQuickForm_group {
// If optional we add a checkbox which the user can use to turn if on.
if ($this->_options['optional']) {
$this->_elements[] = $this->createFormElement('checkbox', 'enabled', null,
get_string('enable'), $this->getAttributes(), true);
get_string('enable'), $this->getAttributesForFormElement(), true);
}
foreach ($dateformat as $key => $value) {
// E_STRICT creating elements without forms is nasty because it internally uses $this
$this->_elements[] = $this->createFormElement('select', $key, get_string($key, 'form'), $value, $this->getAttributes(), true);
$this->_elements[] = $this->createFormElement('select', $key, get_string($key, 'form'), $value,
$this->getAttributesForFormElement(), true);
}
// The YUI2 calendar only supports the gregorian calendar type so only display the calendar image if this is being used.
if ($calendartype->get_name() === 'gregorian') {