Side navigation
#3523 closed enhancement (wontfix)
Opened October 26, 2008 06:37PM UTC
Closed April 16, 2011 08:36PM UTC
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);
Attachments (0)
Change History (6)
Changed October 26, 2008 06:38PM UTC by comment:1
_comment0: | well, that didn't work the way I had intended. Here is the "change to" code again: \ \ <code>/text|hidden|password/i.test(this.type)) || $(this).filter(":submit").length == 1 && /submit/i.test(this.type); </code> → 1289677419857470 |
---|
Changed October 26, 2008 07:51PM UTC by comment:2
need: | Review → Patch |
---|---|
owner: | → john |
You need to wrap them with:
{ { {
code...
} } }
Changed November 13, 2010 07:46PM UTC by comment:3
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.
Changed December 27, 2010 10:36PM UTC by comment:4
keywords: | serialize, submit → serialize,submit,ajaxrewrite |
---|
Changed April 08, 2011 04:46PM UTC by comment:5
Changed April 16, 2011 08:36PM UTC by comment:6
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:
well, that didn't work the way I had intended. Here is the "change to" code again: