Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-27837

Unmask Checkboxes Don't Work As Expected With More Than One Enrolment Key

XMLWordPrintable

    • Any
    • MOODLE_20_STABLE
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • wip-mdl-27837
    • Hide

      Create a course with two or more self-enrolment options with enrolment keys. As a student who isn't already enroled in the course, attempt to enrol yourself. You should see multiple enrolment key options. Each one should have its own Unmask checkbox next to it and clicking each checkbox should unmask the corresponding key entry.

      Show
      Create a course with two or more self-enrolment options with enrolment keys. As a student who isn't already enroled in the course, attempt to enrol yourself. You should see multiple enrolment key options. Each one should have its own Unmask checkbox next to it and clicking each checkbox should unmask the corresponding key entry.

      When a course has more than one self-enrolment type with enrolment keys, the "Unmask" checkboxes for keys after the first one do not show up in the correct place and don't unmask the field. See attached screenshot of a course with two self-enrolment types, each with its own key. Instead of having one Unmask checkbox next to each enrolment key field, both checkboxes appear next to the first key field. Also, the first checkbox unmasks the first key but the second checkbox does nothing--it does not unmask either key.

      In the class definition of enrol_self_enrol_form, $mform->addElement() is passed the string "enrolpassword" which is used to generate the names and IDs of the fields and divs. This is fine with one enrolment type but with more than one, all the options have the same names and IDs. The Unmask checkboxes are inserted via Javascript into a div with ID: id_enrolpasswordunmaskdiv. There are two divs with that ID on the page so all the Unmask checkboxes show up for the first enrolment key, as seen in the screenshot.

      Unique IDs would prevent these unexpected behaviors when there is more than one enrolment key. Perhaps using the heading as part of the string would be helpful. I tried that and it puts the checkboxes in the proper places but changing the string in the addElement() call changes the field name in addition to the div ID and the unknown name breaks the form submission. So that will need to be worked out somehow too.

            rajeshtaneja Rajesh Taneja
            cfollin Chris Follin
            Rossiani Wijaya Rossiani Wijaya
            Sam Hemelryk Sam Hemelryk
            Petr Skoda Petr Skoda
            Votes:
            16 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.