For grouped checkboxes that have numerical keys, why not give them an ID
that's simply a concatenation of NAME and the VALUE, so it's unique?

Run the NAME though a preg_replace to replace non alphanum chars (\W+) with
an underscore first to make sure it's a valid ID.

i.e.

<checkbox name="blah[]" id="blah_1" value="1">
<checkbox name="blah[]" id="blah_2" value="2">

I've used this with some code i wrote that allows me to either output a
multi-select or a group of checkboxes, from a single array of values.

On 5/19/06, Richard Lynch <[EMAIL PROTECTED]> wrote:

Simplest solution is to use id="whatever" for JS.

It *is* possible to get [] into the name of a box in JS, but I never
succeeded in any useful way myself.

On Fri, May 19, 2006 9:33 am, Jay Blanchard wrote:
> Can they play nicely together?
>
> For instance I have a small JavaScript sniplet that will check certain
> checkboxes if a radio button is selected. Since I have a fair amount
> of
> checkboxes I want to put them in an array all their own so I use the
> XHTML syntax w/brackets;
>
> <input type="checkbox" name="list37[]" value="7" />
>
> Suddenly JavaScript doesn't care for the object and throws an error
> (take the brackets out and it works fine for JS, but PHP cannot see
> all
> of the values). I have Googled for this but think that my search
> term(s)
> are failing me because the condition is hard to describe.  Would
> someone
> please point me in the right direction?
>
> Thanks!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Like Music?
http://l-i-e.com/artists.htm

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
Scott Hurring [scott dot hurring dot lists at gmail dot com]
http://hurring.com/

Reply via email to