title: Firefox warns about unsaved data when it shouldn't
body: <p>I ran into the problem with firefox web browser. I am having a form and if you edited one of its field web browser warns you about unsaved data before leaving. An exception is for form submit button. In google chrome everything works fine. Unfortunately firefox doesn't work that way.</p>
  
  <p>There is my script how i generate warn message:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    var formSubmitting = false;
    var setFormSubmitting = function() { formSubmitting = true; };
  
      var _isDirty = false;
      var setDirtyField = function() { _isDirty = true; }
      window.onload = function() {
      window.addEventListener("beforeunload", function (e) {
          var confirmationMessage = 'Nepamirškite užpildyti užduoties žurnalo! ';
          //confirmationMessage += 'If you leave before saving, your changes will be lost.';
  
          if (formSubmitting || !_isDirty) {
              return undefined;
          }
          else{
              (e || window.event).returnValue = confirmationMessage; //Gecko + IE
              return confirmationMessage; //Gecko + Webkit, Safari, Chrome etc.  
          }
  
      });
  };
  &lt;/script&gt;
  </code></pre>
  
  <p>There is the exception for form submit:</p>
  
  <pre><code>&lt;form name="editFrm" action="?m=tasks&amp;amp;a=view&amp;amp;task_id=&lt;?php echo $task_id; ?&gt;" method="post"
    onsubmit='javascript:updateEmailContacts();javascript:setFormSubmitting()'&gt;
  </code></pre>
  
  <p>Any ideas why firefox doesn't work that way like the google chrome?</p>