=== Updated description (for Moodle LMS) ===
When random ids are used in moodle forms, all date elements have the same ids.
To reproduce on 3.11 and master:
- Go to Site administration>Courses>Custom course fields
- Add a new custom field with the type "Date and time"
- inspect the HTML of the form elements for "day", "month", "year" in the "Minimum value" line - they all have the same "id" attribute
This happens in any form that uses random ids. Random ids were introduced in
MDL-65217 by the workplace team and they are only used in Moodle LMS from 3.11, however the error is present in the previous version of Moodle too.
=== Original description (for Moodle Workplace) ===
I've not quite exactly tracked down where this is going wrong but the symptoms are:
On pages such as:
When there's a date selector visible, the same id is repeatedly used for the different component parts of the component, e.g. the day, month and year selects and the checkbox will all have an id of id_jobstartdate_qpuEszZ9BCWsRow.
I think the id_error_jobstartdate_bLahBlAh is also repeated.
On a moodle I checked, a similar control has unique names for each item, like:
but I think these are perhaps just two different form libraries, so possibly this bug is shared with Moodle, but not spotted it anywhere there yet.
I'm thinking this may be an accessability issue (as labels are linked to the item they reference via the id, as well as potentially confusing the JS that is set to run on errors, as well as being a HTML validation issue.