Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#8928 closed bug (invalid)

Form Serialize Not Including Elements Inside Tables

Reported by: hammer544833@… Owned by:
Priority: undecided Milestone: 1.next
Component: ajax Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:

Description

Hello,

I'm using the jQuery library found at http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js and I just found a bug in the .serialize() function for forms.

One of the forms I have contains a table and that holds more input elements and when I tried to submit the form using the jQuery serialize function I get this:

oldPass=&newPass=&question=&answer=

I should be getting something like this:

oldPass=&newPass=&question=&answer=&username=YourTextHere&email=someone@…&phone=1234567890

The following block is my entire form.

Please let me know if and when there is a fix for this bug.

<form id="userInfo" name="user" method="post" action="" title="Change any of these values to update your user information">

<input type="hidden" value="" name="oldPass" /> <input type="hidden" value="" name="newPass" /> <input type="hidden" value="" name="question" /> <input type="hidden" value="" name="answer" />

<table>

<tr>

<td>

<label for='username'>Username:</label>

</td> <td>

<input id='username' type="text" value="" />

</td>

</tr> <tr>

<td>

<label for='email'>Email Address:</label>

</td> <td>

<input id="email" type="email" value="" />

</td>

</tr> <tr>

<td>

<label for="phone">Phone Number:</label>

</td> <td>

<input id="phone" type="text" value="" />

</td>

</tr>

</table>

<div style="text-align:center;">

<span id="user" style="color:red;font-weight:bold"></span><br /> <input type="submit" value="Submit" /> <input type="reset" value="Reset" />

</div>

</form>

Change History (4)

comment:1 Changed 9 years ago by Rick Waldron

Resolution: invalid
Status: newclosed

According to the API, you're doing it wrong. http://api.jquery.com/serialize/

serialize() requires a name attribute

comment:2 Changed 9 years ago by Rick Waldron

Component: unfiledajax

comment:3 Changed 9 years ago by hammer544833@…

The initial results were from the following command

alert($("form#userInfo").serialize());

comment:4 Changed 8 years ago by anonymous

Even when there are name attributes, it does not work with a table in form in IE.

Note: See TracTickets for help on using tickets.