Fix for bug #1600 - multiple selects were being serialized incorrectly.
This commit is contained in:
parent
82eccdfcd0
commit
6d71a10ed2
|
@ -78,7 +78,7 @@ jQuery.fn.extend({
|
||||||
var val = jQuery(this).val();
|
var val = jQuery(this).val();
|
||||||
return val == null ? null :
|
return val == null ? null :
|
||||||
val.constructor == Array ?
|
val.constructor == Array ?
|
||||||
jQuery.map( val, function(i, val){
|
jQuery.map( val, function(val, i){
|
||||||
return {name: elem.name, value: val};
|
return {name: elem.name, value: val};
|
||||||
}) :
|
}) :
|
||||||
{name: elem.name, value: val};
|
{name: elem.name, value: val};
|
||||||
|
|
|
@ -166,11 +166,11 @@ test("serialize()", function() {
|
||||||
expect(6);
|
expect(6);
|
||||||
|
|
||||||
equals( $('#form').serialize(),
|
equals( $('#form').serialize(),
|
||||||
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=0&select3=1",
|
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=1&select3=2",
|
||||||
'Check form serialization as query string');
|
'Check form serialization as query string');
|
||||||
|
|
||||||
equals( $('#form :input').serialize(),
|
equals( $('#form :input').serialize(),
|
||||||
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=0&select3=1",
|
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=1&select3=2",
|
||||||
'Check input serialization as query string');
|
'Check input serialization as query string');
|
||||||
|
|
||||||
equals( $('#testForm').serialize(),
|
equals( $('#testForm').serialize(),
|
||||||
|
@ -182,11 +182,11 @@ test("serialize()", function() {
|
||||||
'Check input serialization as query string');
|
'Check input serialization as query string');
|
||||||
|
|
||||||
equals( $('#form, #testForm').serialize(),
|
equals( $('#form, #testForm').serialize(),
|
||||||
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=0&select3=1&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
|
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=1&select3=2&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
|
||||||
'Multiple form serialization as query string');
|
'Multiple form serialization as query string');
|
||||||
|
|
||||||
equals( $('#form, #testForm :input').serialize(),
|
equals( $('#form, #testForm :input').serialize(),
|
||||||
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=0&select3=1&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
|
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=1&select3=2&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
|
||||||
'Mixed form/input serialization as query string');
|
'Mixed form/input serialization as query string');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue