Browse the Ruby on Rails Community.

You are here: Forums Ask a Rails expert Select_tag and multiple select...

Replytotopic

Select_tag and multiple selection

Posted in Forums : Ask a Rails expert

 
Profile

Authority 0
Posting Rating 0
Sign in to rate this post

Dear frineds, I have a code like this:

<%= select_tag “interviewuser_ids”, options_for_select(Role.get_hr_officers.collect{ |p| [p.full_name, p.id] }, niz),
options ={:multiple =>true, :style=> “height:100px;width:400px;”} %>

where niz is Array of id’s which should be selected.
I tried this in a difefrnet way also with @interviews.user.id insetad of niz, but nothing happens.

Anyone with suggestion?

 
2230883585_3c07ca3353_s

Authority 25
Posting Rating 50
Sign in to rate this post

There is a post on the Ruby forum http://www.ruby-forum.com/topic/107808
Basically, it says that the options that need to be selected need to be integers. Here is the excerpt from the post:
“Had to change:

select_tag :order_hours, options_for_select(filter_hours,
@selected_order_hours)
to
select_tag :order_hours, options_for_select(filter_hours,
@selected_order_hours.to_i)

Replytotopic

Other Recent Topics

Ask a Rails expert : How to parse <pubdate> in RSS

Ask a Rails expert : Couldn't find Product without an ID

Ask a Rails expert : HTML to XML ---> get title & description

Ask a Rails expert : Accessing controller actions from scripted page?

Ask a Rails expert : seledted option for select_tag

Ask a Rails expert : Merging fields from two tables into one, including duplicates

Ask a Rails expert : saving has_many :through

Ask a Rails expert : Use Rails to develop sites for both Designer and Programmer

Ask a Rails expert : Rails+RS232

Ask a Rails expert : Is this a good way to add Admin section

Formatting Help
  • *bold*       _italics_      
    bq. (quotes)
  • "DSC":http://www.dsc.net
  • * or # (lists)
or cancel