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

HTML validation check fails on calendar add event screen

    XMLWordPrintable

    Details

    • Testing Instructions:
      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
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              danielneis Daniel Neis Araujo
              Reporter:
              jenny-gray Jenny Gray
              Peer reviewer:
              Adrian Greeve
              Integrator:
              Dan Poltawski
              Tester:
              John Okely
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                12/May/14