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: |
Description
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:
/text|hidden|password/i.test(this.type));
to this:
/text|hidden|password/i.test(this.type)) $(this).filter(":submit").length == 1 && /submit/i.test(this.type);
Change History (6)
comment:3 Changed 14 years ago by
need: | Review → Patch |
---|---|
Owner: | set to john |
You need to wrap them with:
{ { { code... } } }
comment:4 Changed 12 years ago by
Status: | new → open |
---|
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
Keywords: | ajaxrewrite added |
---|
comment:7 Changed 12 years ago by
Resolution: | → wontfix |
---|---|
Status: | open → closed |
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/
well, that didn't work the way I had intended. Here is the "change to" code again: