Skip to main content

Bug Tracker

Side navigation

#13357 closed bug (notabug)

Opened January 31, 2013 12:59PM UTC

Closed January 31, 2013 01:31PM UTC

Last modified July 22, 2014 03:03PM UTC

serialize() behaves inconsistently for fieldset

Reported by: mikecapp Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.0
Keywords: Cc:
Blocked by: Blocking:
Description

I have a large-ish form already organized into fieldsets, and I want to serialize a subset of those fields for an AJAX call. The obvious approach was $("#somefieldset").serialize(), but while this works in Chrome it returns nothing in IE7. It's not clear from the docs whether this *should* work, but if not the results should at least be consistent.

$("#somefieldset input").serialize() is fine as a workaround, so this isn't the end of the world.

Fiddle: http://jsfiddle.net/mikecapp/rSwUW/

Chrome output: core1=one&core2=two

IE7 output: nothing!

Attachments (0)
Change History (2)

Changed January 31, 2013 01:31PM UTC by dmethvin comment:1

resolution: → notabug
status: newclosed

The method is consistent with its documentation. There's no mention of handling the <fieldset> container element.

The .serialize() method can act on a jQuery object that has selected individual form elements, such as <input>, <textarea>, and <select>. However, it is typically easier to select the <form> tag itself for serialization

It can take either a <form> element (in which case it will serialize the form.elements property) or a jQuery set of form inputs. It may be possible to pass in other things and get outputs but they're not documented.

Changed July 22, 2014 03:03PM UTC by gibson042 comment:2

#15191 is a duplicate of this ticket.