title: Using jQuery to store the state of a complicated form
body: <p>I have a rather complicated form with many "steps" in it that are filled in by the user. Some steps (think of them as form segments) have default options, but on clicking a "enter custom values," they display a hereto hidden set of fields that the user can enter info in. Here is an example</p>
  
  <pre><code>&lt;div id="#s1_normal"&gt;
  &lt;input type="radio" name="mode" value="a"&gt; Mode A
  &lt;input type="radio" name="mode" value="b"&gt; Mode B
  Choose one of the above for applying average coefficient 
  values of "a" or "b" to 100% of your product or
  &lt;a href="#" onclick="toggleCustom('s1');"&gt;enter custom values&lt;/a&gt;
  &lt;/div&gt;
  
  &lt;div id="#s1_custom"&gt;
  %a: &lt;input type="text" name="perc_a"&gt; coeff. a &lt;input type="text" name="coeff_a"&gt;
  %b: &lt;input type="text" name="perc_b"&gt; coeff. b &lt;input type="text" name="coeff_b"&gt;
  Enter custom values above or 
  &lt;a href="#" onclick="toggleCustom('s1');"&gt;choose average values&lt;/a&gt;
  </code></pre>
  
  <p>There are several such segments, for example, #s1 .. #s7. Here is my task. I want to enable the user to save the state of a form. So, once a user has filled out the entire form, choosing average defaults for some segments, and entering custom values for other, the user is able to click a button and have the entire state saved for thawing later. I am thinking, if I can save the state in an object that I can serialize, I can save it in a db table or some other persistent storage.</p>
  
  <p>The user can come back at a later time and re-construct the entire previous session.</p>
  
  <p>How do I do this? There is the getAttributes plugin <a href="http://plugins.jquery.com/project/getAttributes" rel="noreferrer">http://plugins.jquery.com/project/getAttributes</a>, and there is the jQuery serialize method, but I can't for the life of me get started. Please nudge me in the right direction.</p>