Bug Tracker

Opened 14 years ago

Closed 12 years ago

#3523 closed enhancement (wontfix)

serialize() and serializeArray() to include submit button when only one in form

Reported by: kswedberg Owned by: john
Priority: minor Milestone: 1.3
Component: ajax Version: 1.2.6
Keywords: serialize, submit, ajaxrewrite Cc:
Blocked by: Blocking:


Per John Resig's request (http://groups.google.com/group/jquery-dev/browse_thread/thread/f82bccd7bebdc838), I'm submitting this ticket to include the submit button in the serialize() string / serializeArray() object when there is only one submit button in the form, even though, as he mentioned, "we may not get to it."

I'm sure it can be improved quite a bit, but here is one way to achieve this:

change line 74 of ajax.js from this:


to this:


$(this).filter(":submit").length == 1 && /submit/i.test(this.type);

Change History (6)

comment:1 Changed 14 years ago by kswedberg

well, that didn't work the way I had intended. Here is the "change to" code again:

/text|hidden|password/i.test(this.type)) || 
    $(this).filter(":submit").length == 1 && 
Last edited 12 years ago by dmethvin (previous) (diff)

comment:3 Changed 14 years ago by flesler

need: ReviewPatch
Owner: set to john

You need to wrap them with:

{ { { code... } } }

comment:4 Changed 12 years ago by dmethvin

Status: newopen

I'd prefer to see a way to specify the button that was pressed, which would work for cases where there are multiple buttons as well.

comment:5 Changed 12 years ago by Rick Waldron

Keywords: ajaxrewrite added

comment:7 Changed 12 years ago by john

Resolution: wontfix
Status: openclosed

Yeah, I don't think that is something that we're going to change - this is precisely why the jQuery Ajax Form plugin exists: http://jquery.malsup.com/form/

Note: See TracTickets for help on using tickets.