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

Autocomplete element triggers 'onchange' event after loading form

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.1
    • Component/s: JavaScript
    • Labels:
    • Testing Instructions:
      Hide
      1. Enable the 'Course meta link' enrolment method
      2. Head to a course enrolment methods
      3. Go to the form to add a new 'Course meta link' instance
      4. Leave the page without doing anything
        • Confirm that you are not asked if you really want to leave the page
      5. Head back to the form, but this time select a course in the auto complete element
      6. Leave the page
        • Confirm that you are asked if you are sure that you want to leave the page
      Show
      Enable the 'Course meta link' enrolment method Head to a course enrolment methods Go to the form to add a new 'Course meta link' instance Leave the page without doing anything Confirm that you are not asked if you really want to leave the page Head back to the form, but this time select a course in the auto complete element Leave the page Confirm that you are asked if you are sure that you want to leave the page
    • Affected Branches:
      MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-53730-master

      Description

      When 'course' element is populated with initial data it triggers 'onchange' JS event.
      If developer, for example, wants to attach a listener that automatically submits the form, it enters into the indefinite loop of redirections.

      Example:

      1. revert commit https://github.com/moodle/moodle/commit/9b9b9caba380af84dabad587d2223b9846e1e48e
      2. create feedback on the front page
      3. go to course mapping tab, add some courses, refresh
      4. in network tab you will see that request to coursemap.php is set immediately on page load and not only after a change to the course mapping

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  23/May/16