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

Let user confirm leaving a page without saving form chages

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • 1.9
    • Forms Library
    • None
    • MOODLE_19_STABLE

      This is a proposal for a feature I have seen in Plone (see http://plone.org/products/plone/roadmap/24)

      Motivation
      =======

      Many times it happens that a user has written lots of text in a form and forgets to click Save or by accident clicks on a link or moves to another url. It is desirable that in such a situation the browser (Moodle) asks the user if she really wants to navigate away and lose her editing.

      Proposal
      ======

      On browsers which support it, Moodle should warn before allowing the user to navigate away from a page which contains an edited form. As I have googled, IE4+/Win, Mozilla 1.7a+, Netscape 7.2+, and Firefox support the onBeforeUnload event that is fired before the browser navigates away. The event allows displaying a form which gives the user the option to continue to navigate away from the page, or to cancel the navigation and return to editing the form.

      The idea is to add handling code linked to this event, that checks if the user has edited/modified the form and if no submit is clicked, he is presented a dialog where he can confirm his action. Browsers that do not support the event won't notice this mechanism (graceful degredation).

      The handler should ignore the supplementary forms which can appear on a page such as the search box. It seems to me, that the feature should be used only on pages containing a form (forms) based on Moodle Forms library.

      Attached there is an example.html.txt that demonstrates how this could work.

        1. example.html.txt
          1 kB
          David Mudrák (@mudrd8mz)

            mudrd8mz David Mudrák (@mudrd8mz)
            mudrd8mz David Mudrák (@mudrd8mz)
            Votes:
            9 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.