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

Autocomplete/Tags fields mark form dirty on initalisation, dont honour ignoredirty

XMLWordPrintable

    • MOODLE_30_STABLE
    • MOODLE_30_STABLE
    • Hide
      1. Ensure tags are enabled
      2. Load a form that has a tags field (e.g. Course edit form)
      3. Make no changes, click a link to leave the page. You should be able to leave without seeing a warning
      4. Return to the form
      5. Enter a tag in the tags field
      6. Click a link to leave the page. You should see a warning.
      7. Place attached autocomplete.php in your moodle directory
      8. Visit /autocomplete.php
      9. Add some tags to the tags field
      10. Click the "Home" link in the footer. You should be able to leave the page unprompted, as the field has the "ignoredirty" class.
      Show
      Ensure tags are enabled Load a form that has a tags field (e.g. Course edit form) Make no changes, click a link to leave the page. You should be able to leave without seeing a warning Return to the form Enter a tag in the tags field Click a link to leave the page. You should see a warning. Place attached autocomplete.php in your moodle directory Visit /autocomplete.php Add some tags to the tags field Click the "Home" link in the footer. You should be able to leave the page unprompted, as the field has the "ignoredirty" class.

      Steps to reproduce (Moodle 3.0):

      • Load a form with a tags or autocomplete field (e.g. the course edit form, when tags are enabled)
      • Make no changes, and click a link to another page
      • Expected: There are no unsaved changes, so the new page is loaded with no warning
      • Actual: The browser displays a warning of unsaved changes.

      MDL-52760 added a call to M.core_formchangechecker.set_form_changed() when an autocomplete filed is changed, so autocompletes would trigger the "unsaved data" warning like other fields. However, this is also called during the initialisation of the form, meaning the form is immediately marked dirty. set_form_changed() is also called with no arguments, meaning that it doesn't honour the "ignoredirty" class which would otherwise be a possible workaround.

      The new autocomplete field in Moodle 3.1 doesn't exhibit this behaviour.

            marxjohnson Mark Johnson
            marxjohnson Mark Johnson
            Jason Platts Jason Platts
            Dan Poltawski Dan Poltawski
            Jake Dallimore Jake Dallimore
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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