diff options
author | John Resig <jeresig@gmail.com> | 2007-09-05 17:06:05 +0000 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2007-09-05 17:06:05 +0000 |
commit | f96bf1041553775a94c1034c97e253e350217173 (patch) | |
tree | ec325ec45526f3caddac0157f98645ca7aaad64c /build | |
parent | f28f199dc0a353135ef8b9afa2f3d25c6ffd2c75 (diff) | |
download | jquery-f96bf1041553775a94c1034c97e253e350217173.tar.gz jquery-f96bf1041553775a94c1034c97e253e350217173.zip |
Integration of Mike Alsup's excellent form serialization code. The benefits are as follows:
- New method: .serializeArray()
This returns an array of name/value pairs representing the contents of a form, or individual input elements.
- Enhancement: .serialize()
The results are correct now (as opposed to the mess from before), and allows you to serializes forms directly (rather than just the input elements).
- Enhancement: .val()
This now returns the correct value when dealing wih selects. Additionally, when dealing with multiple selects, it returns an array of values.
Based upon Mike's code:
http://malsup.com/jquery/form/comp/form.js
and test suite:
http://malsup.com/jquery/form/comp/test.html
Diffstat (limited to 'build')
-rw-r--r-- | build/test/index.html | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/build/test/index.html b/build/test/index.html index 3b59b0e79..b2876b7bb 100644 --- a/build/test/index.html +++ b/build/test/index.html @@ -116,6 +116,39 @@ </div> <div id="fx-tests"></div> + + <form id="testForm" action="#" method="get"> + <textarea name="T3" rows="2" cols="15">? +Z</textarea> + <input type="hidden" name="H1" value="x" /> + <input type="hidden" name="H2" /> + <input name="PWD" type="password" value="" /> + <input name="T1" type="text" /> + <input name="T2" type="text" value="YES" readonly="readonly" /> + <input type="checkbox" name="C1" value="1" /> + <input type="checkbox" name="C2" /> + <input type="radio" name="R1" value="1" /> + <input type="radio" name="R1" value="2" /> + <input type="text" name="My Name" value="me" /> + <input type="reset" name="reset" value="NO" /> + <select name="S1">
<option value="abc">ABC</option>
<option value="abc">ABC</option>
<option value="abc">ABC</option>
</select>
<select name="S2" multiple="multiple" size="3">
<option value="abc">ABC</option>
<option value="abc">ABC</option>
<option value="abc">ABC</option>
</select> + <select name="S3"> + <option selected="selected">YES</option> + </select> + <select name="S4"> + <option value="" selected="selected">NO</option> + </select> + <input type="submit" name="sub1" value="NO" /> + <input type="submit" name="sub2" value="NO" /> + <input type="image" name="sub3" value="NO" src="submit.gif" /> + <button name="sub4" type="submit" value="NO">NO</button> + <input name="D1" type="text" value="NO" disabled="disabled" /> + <input type="checkbox" checked="checked" disabled="disabled" name="D2" value="NO" /> + <input type="radio" name="D3" value="NO" checked="checked" disabled="disabled" /> + <select name="D4" disabled="disabled"> + <option selected="selected" value="NO">NO</option> + </select> + </form> </div> </dl> |