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

id_commitbutton Duplication/Multiplication of HTML ID

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.5.11, 3.6.9, 3.7.5, 3.8.2, 3.8.3, 3.9
    • Fix Version/s: None
    • Component/s: Forms Library
    • Labels:
    • Affected Branches:
      MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE

      Description

      Dear All,

      Using Moodle forms, in order to add a save/cancel pair of buttons we have to call this function:

      $this->add_action_buttons();

      I have found when multiple Moodle forms exist in the same page, no matter where they are (main content, block etc) the same HTML id is utilised id_commitbutton which then is a violation of the uniqueness in the same page and the mentioned id is hard coded in many places in Moodle code BehaT tests, which I suspect tests in pages with two forms will fail or choose the wrong form to submit.

      As this is a core design with many aspects in functionality of the forms, the behavioural tests or third party development distinct logic, I would like an input from the community, such as being able to add a custom pair of IDs for Save/Cancel, or a class to define and utilise in BehaT features instead of this multiple used ID.

       

      Also the labels for these two buttons are empty and this is another accessibility issue, we either have to remove the labels or utilise them in a valid way.

      Here is an example:

       <div class="col-md-9 form-inline felement" data-fieldtype="submit" style="">
                  <input type="submit" class="btn
                          btn-primary
                          
                          " name="submitbutton" id="id_submitbutton" value="Save changes" style="">
              <div class="form-control-feedback invalid-feedback" id="id_error_submitbutton" style="">
                  
              </div>
          </div>
       
      .
      .
      .
       
      <span data-fieldtype="submit" id="yui_3_17_2_1_1588077909256_643" style="">
              <input type="submit" class="btn
                          btn-primary
                          
                          " name="submitbutton" id="id_submitbutton" value="Save" style="z-index: 2147483646; position: relative;">
          </span>

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            amfipolis VASILEIOS SOTIRAS
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 minutes
                5m