Uploaded image for project: 'HTML Form Entry Module'
  1. HTML Form Entry Module
  2. HTML-35

Clicking on any external link discards the HTML Form you are entering

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Should
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: HTML Form Entry 2.0
    • Labels:
      None
    • Complexity:
      Medium

      Description

      We should apply the common pattern used all over the web, where if you try to navigate away from a page that has unsaved data, you get a confirmation alert.

      I think this can be done pretty easily by adding something like the following code to htmlformentry.jsp

      // put this global variable at the top
      var protectNavigation = false;
      
      // this goes in the document-ready function
      // I think jQuery.on is not supported in the version of JQuery that HFE uses, but verify this, because that would be better than delegate
      // regardless, the point of the ticket is to test this and make sure it works right, doesn't clobber other change handlers, etc
      $j('#htmlform').delegate(':input', 'change', function() {
      	protectNavigation = true;
      });
      
      // this goes at the end, I think
      window.onbeforeunload = function() {
      	if (protectNavigation && !tryingToSubmit) {
      		return "If you leave this page you will lose unsaved changes";
      	}
      }
      

        Attachments

          Activity

            People

            Assignee:
            slorenz Stephen Lorenz
            Reporter:
            mseaton Mike Seaton
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 4 hours
                4h
                Remaining:
                Time Spent - 1 hour Remaining Estimate - 3 hours
                3h
                Logged:
                Time Spent - 1 hour Remaining Estimate - 3 hours
                1h