title: Detecting changed form values -- Firefox replaces with user-input values, breaking dirtiness detection
body: <p>I'm implementing form dirtiness detection for a web-app. The 'dirtiness' that I'm interested in is the server's value versus what's displayed on the form. The server is running Django, most of our scripting is in jQuery.</p>
  
  <p>We serve the form fields with the correct default values corresponding to the value on the server, e.g.</p>
  
  <pre><code>&lt;input name="foo" type="text" value="this is the saved value" id="id_foo" /&gt;
  </code></pre>
  
  <p>The standard answer is to iterate through the form inputs and save their initial values for later comparison at load time.</p>
  
  <p>This works in most cases, but Firefox breaks this by sometimes ignoring the supplied value and instead replacing it with the user's last input. So, for example: We serve the form, the user modifies it ("now it's dirty"), then refreshes; Firefox replaces the value with the user's last input.</p>
  
  <p>This breaks the script detecting dirtiness, because its initial value is <em>not</em> the one the server supplied, but rather the one the user entered before the refresh. The script has no way of accessing the original value at that point.</p>
  
  <p>How are other developers getting around this? Right now I'm supplying a hidden span with the <em>real</em> original value, but it feels incredibly hacky:</p>
  
  <pre><code>&lt;input name="foo" type="text" value="this is the saved value" id="id_foo" /&gt;
  &lt;span class="original-value" id="id_foo_orig"&gt;this is the saved value&lt;/span&gt;
  </code></pre>
  
  <p>Is there some way to disable this behaviour for inputs in Firefox? (IE and Chrome at least don't do this) 
  Am I missing something fundamental here?</p>
  
  <p>Thanks,<br>
  &nbsp;&nbsp;Robert</p>