On 22 Nov 2008, at 23:02, Will wrote:

>
> The problem is that is the collection select object is repeated in a
> table of objects so this ID appears multiple times.  To deal with it I
> created a <form id ="#{machine.fqdn}"> .... collection_select object  
> </
> form> around each of these and tried to refer to them using $("#
> {machine.fqdn}").machine_user_id.selectedIndex=whatever, but the
> prototype $() function does not seem to want to take a variable.  It
> seems to work with a static id, but not a variable one.  Any ideas how
> this could be done?

Having multiple elements on a page with the same dom id is a super  
super bad idea. Instead of creating that form with that special id,  
why not give that id to the select box ?
The $ function is just a regular function - it doesn't care whether  
its argument is a literal, a function call or something else.
Regardless, '.machine_user_id' is not how you would find the child of  
a certain element. If you want the child of an element matching a  
given css selector use the down function.

Fred
>
>
> Thanks
> Will
>
> On Nov 21, 10:26 am, Frederick Cheung <[EMAIL PROTECTED]>
> wrote:
>> On Nov 21, 3:19 pm, Will <[EMAIL PROTECTED]> wrote:
>>
>>> I have a table with a collection select object  that I am looking
>>> update the selectedIndex of using links on the page
>>
>> Does it need to be any more complicated than $
>> ('machine_user_id').selectedIndex = whatever (check that I got the
>> dom_id of your select box right ?)
>> if you also want to change the images on the links you'll probably
>> make life easier for your self if the image for the link is a css
>> property.
>>
>> Fred
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to