title: HTML Form - Don't Write Default Values
body: <p>I've found a ton of solutions online for clearing default text out of a field when the field is focused on, then replacing it if the user exits the field without entering anything. The one I finally went with was this solution from Electric Toolbox (http://www.electrictoolbox.com/jquery-change-default-value-on-focus/):</p>
  
  <pre><code>$('.default-value').each(function() {
  var default_value = this.value;
  $(this).focus(function() {
      if(this.value == default_value) {
          this.value = '';
      }
  });
  $(this).blur(function() {
      if(this.value == '') {
          this.value = default_value;
      }
  });
  });
  </code></pre>
  
  <p>This works just fine; every text input field of class default-value switches to a blank field when focused on. When I leave the field, either the default value returns if nothing was entered, or if something was entered, that data stays in the field. So far so good.</p>
  
  <p>There's a catch here however; the data in the default of the field is being written to the database when the user submits the form. Since not all of our fields are required, we have several which a user may not choose to fill out. This means we have a final data list with a lot of people with an address of: "John Sample, Street Address, Address 2, City State Zip."</p>
  
  <p>What I would love is to be able to tell the form not to submit fields if the information in them matches the default. I don't know javascript - I'm just cobbling together code that I can find - so I'm sure I have the syntax wrong, but ideally this would be something like:</p>
  
  <pre><code>onsubmit
  if address1 = "Street Address"
  then address1 = ""
  </code></pre>
  
  <p>Is there any reasonably clean and simple way to do this? (Also, if you could explain it like you're talking to someone who recently suffered a traumatic brain injury, that would be good too.)</p>