[jQuery] Re: checkbox array

2009-03-03 Thread ricardobeat
http://www.w3.org/TR/html401/interact/forms.html#adef-name-FORM This is still in use because it's the easiest/fastest way of getting an array with the selected options server-side. There is no simpler alternative. - ricardo On Mar 3, 12:53 am, mkmanning wrote: > That argument's been raging for

[jQuery] Re: checkbox array

2009-03-03 Thread mkmanning
You don't need to escape them, $('input:checkbox[name=foo[]]:checked').serialize() works as well. If you want the brackets instead of %5B%5D just use unescape: unescape($('input:checkbox[name=foo[]]:checked').serialize()); Either way it's ugly ;) On Mar 3, 6:47 am, dabear wrote: > If you real

[jQuery] Re: checkbox array

2009-03-03 Thread dabear
If you really need those brackets, just escape them with two backslashes: $('input[name=foo\\[\\]]:checked').length If you need them as a post query, just use : var $foos = $('input[name=foo\\[\\]]:checked'); var postQuery = $.param($foos); On Mar 2, 6:08 am, mklebel wrote: > Been losing my

[jQuery] Re: checkbox array

2009-03-02 Thread mkmanning
That argument's been raging for a while :) There appear to be two halves, those that say 'CDATA', so any text is OK, and those that read the next part of the spec "For some HTML 4 attributes with CDATA attribute values, the specification imposes further constraints on the set of legal values for

[jQuery] Re: checkbox array

2009-03-02 Thread Matt Kruse
On Mar 2, 6:51 pm, mkmanning wrote: > HTML 4 spec section 6.2 says, "ID and NAME tokens must begin with a > letter ([A-Za-z]) and may be followed by any number of letters, > digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and > periods (".")." The NAME attribute is CDATA, not ID

[jQuery] Re: checkbox array

2009-03-02 Thread mkmanning
HTML 4 spec section 6.2 says, "ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".")." XHTML spec section C.8 says, "Note that the collection of legal values in XML 1.0

[jQuery] Re: checkbox array

2009-03-02 Thread Matt Kruse
On Mar 2, 1:32 pm, mkmanning wrote: > And (if I had a nickel for every time I've said this), using [] in the > name isn't valid; any framework that requires you to compromise your > markup is a deficient framework IMO. It is most certainly valid to use "[]" in an input name. See any one of many

[jQuery] Re: checkbox array

2009-03-02 Thread mkmanning
$('input:checkbox[name^=foo]:checked').serialize() And (if I had a nickel for every time I've said this), using [] in the name isn't valid; any framework that requires you to compromise your markup is a deficient framework IMO. On Mar 2, 6:17 am, MorningZ wrote: > Well the variable is undefin

[jQuery] Re: checkbox array

2009-03-02 Thread MorningZ
Well the variable is undefined because your selector is wrong Your selector $('input[name=foo]: would find not "foo[]".. different names, different results besides, i don't believe (could be mistaken) that selecting checkboxes and saying ".val()" won't result in an array of values but rat