Forum: Ruby on Rails Add items to select_tag?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7c8f8b6eae4dd991e3a9065c68451361?d=identicon&s=25 Wai Tsang (sneptune)
on 2007-02-20 17:06
Hi,

I have been struggling with the select tag for the last two days.  Does
anyone know how to change the content of a select_tag?  More
specifically, I have a list of items on another select_tag.  I would
like to make it so that the user can add the items into their own list.
I tried this in my controller (with KRJS plugins)

def on_item_list_dblclick
    render :update do |page|
      page['user_list'].add = params[:dom_value]
    end
end

Changing text in a textbox is simple, but I can't find any documentation
about how to add to a select list.  Any help would be appreciated.
Thank you.
7c8f8b6eae4dd991e3a9065c68451361?d=identicon&s=25 Wai Tsang (sneptune)
on 2007-02-20 23:19
It seems like page['user_list'].add takes two arguments, both of which
should be DOM element object.  How do I create DOM element object in
controller?
This topic is locked and can not be replied to.