You can't (legally) use a square bracket in an ID. You can in a name,  
but that's not the same thing. What I usually do when I need this sort  
of thing (for PHP processing, mostly) is to construct names and IDs  
inside of a loop on the server, formatting them like this:

<input type="checkbox" id="foo_1" name="foo[1]" value="1" />
<input type="checkbox" id="foo_2" name="foo[2]" value="1" />
<input type="checkbox" id="foo_3" name="foo[3]" value="1" />
<input type="checkbox" id="foo_4" name="foo[4]" value="1" />

This would work the same way if you were setting all of them to empty  
brackets (to let the browser work out the indexes for you) -- just set  
each ID to an incremental number and don't let them clash with one  


On Dec 23, 2008, at 7:38 PM, mrg wrote:

> Hi
> I have an array of id's.  How do I pass an array id as a container to
> Ajax.Updater?
> I tried Ajax.Updater('hostnameID[1]', ...
> but that didnt work.
> The ID is like this: <td><select id=hostnameID[] ...>  </select>
> It works if I just put the number in the id - like this: hostname0ID,
> hostname1ID, etc...
> ie: This works fine: Ajax.Updater('hostname1ID', ...
> Just thought it would be cleaner if I used an array.
> thx
> matt
> >

You received this message because you are subscribed to the Google Groups 
"Prototype &" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to