Form.serialize turns a form’s elements into a query string with each query component separated by an ‘&’-character. This makes it very useful for contructing a GET query from a form.
Form.serialize( element );
element can be a Form object or the ID of a Form object.
<form id="just-a-form" onchange="$('serialized').value=Form.serialize(this);">
<input type="hidden" name="id" value="14" />
<p>
<label>Your name:
<input type="text" size="20" name="name" value="Anonymous Coward" />
</label>
</p>
<p>
Your gender:
<label><input type="radio" name="gender" value="m" /> Male</label>
<label><input type="radio" name="gender" value="f" /> Female</label>
</p>
<p>
Your Friends:<br>
<select multiple="multiple" size="5" name="friends[]">
<option value="Joe">Joe</option>
<option value="Mary">Mary</option>
<option value="John">John</option>
<option value="Bill">Bill</option>
</select>
</p>
<p>
Types of candy you like:<br>
<input type='checkbox' name='candy[]' value='sugar'>Sugar<br>
<input type='checkbox' name='candy[]' value='chocolate'>chocolate<br>
<input type='checkbox' name='candy[]' value='honey'>Honey<br>
</p>
</form>
<input type="text" size="40" id="serialized" />
creates:
Its important to note that the Form.serialize method separates values with commas, so if you use a language such as PHP, you would be expecting to grab friends[] and candy[] as an array, but its just a comma delimited string it seems for serialized multiple selects.