Selected values in combo box

how to set default value in combo box or whether there is another way

plz explain with example code

advance thx
have a nice day

Narayana Karthik wrote:

how to set default value in combo box or whether there is another way

plz explain with example code

advance thx
have a nice day

Narayana,

Just by setting :selected.

For example:
<%= select(:your_model, “user_id”, User.find(:all).collect {|s| [
s.name, s.id ] }, { :include_blank => false, :selected =>
@your_model.user_id }) %>

Jean-Etienne

hai jean
thx for solving my problem, Have a pleasant day
thx once again
bye bye…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs