Ticket #1600 already raised.


Pyrolupus wrote:
> 
> 
> In testing Chistoph's code, I encountered a separate but possibly
> related issue:  serialize() and serializeArray() are returning things
> I did not expect for multiple selects.  For the following form:
> 
> <form id="mydForm">
>       <select id="myd" name="myd" multiple>
>               <option value="black">Black</option>
>               <option value="blue" selected>Blue</option>
>       </select>
> </form>
> 
> Calling  $('form#mydForm').serialize() returns:
> 
> "myd=0"
> 
> Am I doing something wrong as well (besides my old-timey no-value
> "multiple" and "selected" attributes--though proper XHMTL gives the
> same result), or should this be posted to -dev as a bug?
> 
> Pyro
> 
> On Sep 12, 4:20 am, Christoph Roeder <[EMAIL PROTECTED]>
> wrote:
>> Hello,
>>
>> I'm trying to serialize a form with select-fields defined as multiple,
>> e.g.:
>> ~~~~~~~~~~~~~
>> <select multiple="multiple" name="test[]">
>>     <option value="one" selected="selected">One</option>
>>     <option value="two">Two</option>
>>     <option value="three" selected="selected">Three</option>
>> </select>
>> ~~~~~~~~~~~~~
>>
>> When I now try this:
>>
>> ~~~~~~~~~~~~~
>> $("select").serialize();
>> ~~~~~~~~~~~~~
>>
>> or this:
>>
>> ~~~~~~~~~~~~~
>> $("select").serializeArray();
>> ~~~~~~~~~~~~~
>>
>> I get an empty string resp. array.
>>
>> But I should get this:
>>
>> ~~~~~~~~~~~~~
>> test[]=one&test[]=three
>> ~~~~~~~~~~~~~
>>
>> resp. this:
>>
>> ~~~~~~~~~~~~~
>> {
>>   test: ["one", "two"]}
>>
>> ~~~~~~~~~~~~~
>>
>> Whats wrong with my code?
>>
>> PS: I'm currently using Prototype with PHP in the backend, there it
>> just works fine.
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/jQuery-1.2---Serialize-a-form-as-JSON-tf4428762s15494.html#a12638084
Sent from the JQuery mailing list archive at Nabble.com.

Reply via email to