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

Autocomplete element triggers 'onchange' event after loading form

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1
    • 3.1
    • JavaScript
    • MOODLE_31_STABLE
    • MOODLE_31_STABLE
    • MDL-53730-master
    • 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

    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

              fred Frédéric Massart
              marina Marina Glancy
              Ryan Wyllie Ryan Wyllie
              Dan Poltawski Dan Poltawski
              Adrian Greeve Adrian Greeve
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                23/May/16