jQuery: The Write Less, Do More JavaScript Library

Ticket #1593 (closed bug: wontfix)

Opened 1 year ago

Last modified 9 months ago

Serialize ignores buttons

Reported by: oridan Assigned to: anonymous
Type: bug Priority: major
Milestone: 1.2.1 Component: core
Version: 1.2 Keywords:
Cc: Needs: Review

Description

when specifically selecting a button and serializing it, it is no longer serialized properly, it used to give you:

buttonA=buttonValue

but it now returns an empty string.

Example:

<input id="buttonA" type='button' name="buttonA" value="buttonValue">
<script>
alert(jQuery("#buttonA").serialize());
</script>

Worked fine in 1.1.4, broken in 1.2

Attachments

Change History

Changed 1 year ago by john

  • status changed from new to closed
  • resolution set to wontfix

That's correct, we changed how serialization was done in 1.2 so that it will properly mimick how forms are actually serialized in a browser. We don't plan on reverting and making it invalid.

In the meantime you can just append the button name/value to the end of the string returned from serialize.

Changed 1 year ago by oridan

ahh yes, i see. It does make more sense that way, since clicking a "button" doesnt normally get serialised, only clicking a "submit".

Many Thanks, Tom

Changed 9 months ago by umonkey

John, what do you mean by "making it invalid"? Gecko based browsers do submit the value of a button (checked with Firefox and Epiphany), Opera does so to, W3C says it should be so. It's the only way to make multi-button forms localized, not just a silly feature for fun. Only IE implements it unlike the rest, as usual.

I understand that the goal of jQuery is to work equally in all browsers, rather than being standard-compliant, but this argumentation ("making it invalid") still sucks. Browsers do submit button values, jQuery does not. This is invalid.

Note: See TracTickets for help on using tickets.