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

HTML validation check fails on calendar add event screen

XMLWordPrintable

    • MOODLE_25_STABLE
    • MOODLE_27_STABLE
    • Easy
    • Hide
      1. open moodle using default theme
      2. go to calendar add event screen (calendar/event.php?action=new)
      3. validate source code at validator.w3.org
      4. make sure the problems with the validation are only because of "summary" and "name" attributes are obsolete
      Show
      open moodle using default theme go to calendar add event screen (calendar/event.php?action=new) validate source code at validator.w3.org make sure the problems with the validation are only because of "summary" and "name" attributes are obsolete

      On the calendar add event screen calendar/event.php?action=new&course=1, in the "duration" section of the form, there are three radio buttons. The choice of radio button enables/disables other form fields that are displayed between the radio buttons.

      That's a lovely display for usability, but the radio buttons are added individually using $mform->addElement rather than in a group. When you submit the code of this page to the W3C validator, it reports errors for all but the first radio button.

      Error Line 237, Column 59: Duplicate ID fitem_id_duration_0.

      …duration_0" class="fitem fitem_fradio"><div class="fitemtitle"><label for="id_…

      Warning Line 236, Column 59: The first occurrence of ID fitem_id_duration_0 was here.

      This is because the html generated for the radio buttons has not got quite the right id added.

      <div class="fitem fitem_fradio" id="fitem_id_duration_0"><div class="fitemtitle"><label for="id_duration_2"> </label></div><div class="felement fradio"><span><input type="radio" id="id_duration_2" value="2" name="duration"><label for="id_duration_2">Duration in minutes</label></span></div></div>

      Here you can see that the surrounding div uses id="fitem_id_duration_0" even though the actual form field is id="id_duration_2".

      Is it possible to fix the forms library code that generates this html to use the correct outer div id? Or does the form layout need a rethink.

            danielneis Daniel Neis Araujo
            jenny-gray Jenny Gray (Inactive)
            Adrian Greeve Adrian Greeve
            Dan Poltawski Dan Poltawski
            John Okely John Okely
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

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