Forum: Ruby dynamically adding options to select tags

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Josh (Guest)
on 2007-01-18 19:31
(Received via mailing list)
The set up is this:  Throughout the page I have a certain drop-down
repeated many times.  It is given class="owner_column"  It's possible I
could generate a unique ID for each of these, but it may prove to be
difficult -- although I'll manage if it turns out to be necessary.

My problem is adding a new "owner" to all of these drop downs
dynamically.   I've been experimenting with variations on the
following:'select.owner_column').each do |foo|
    foo.replace_html 'blah'

Where "blah" will probably end up being a partial or an explicit
<object> statement.  But for the time being even inserting the word
"blah" isn't working.

This produces an error saying that "replaceHtml" is not a valid
function.  Notice that at some point my "replace_html" got changed to
"replaceHtml" (I'm not sure why or how this happened)

Some points to consider:

If instead I do foo.hide all of the select statements disappear as
expected.  This leads me to believe my select statement is accurately
grabbing the correct objects.

replace_html takes an id argument.  Is it mandatory, if so, what do
send in its placesince I dynamically grabbed the objects I want to

Thanx for your help!!
This topic is locked and can not be replied to.