Setting the selected value in select helper

I have the follwoing select in my view

<%= select(‘role’, ‘name’, Role::DEFAULT_COMPANY_NAMES, { :prompt =>
l(:select_a_role) }, {:style => ‘width:150px;’}) %>

<%= select(‘role’, ‘company_id’, @company_choices, { :prompt =>
l(:select_a_company) }, {:style => ‘width:200px;’}) %>

on first display I have the prompt, Ok
but when the user forget to select one of 2 seeltions, I would like
to redisplay the already selected one…

I tried
@role_name = params[:role][:name]
@role_company_id = params[:role][:company_id]
before redisplay but no pre-selctiuon is being made ( because of the
prompt… ??)

thanks

erwin

this works on your model.
so you need something like
@role = Role.new(:name => params[:role][:name], :company_id =>
params[:role][:company_id])

On 30 juin, 22:22, Thorsten Müller [email protected] wrote:

this works on your model.
so you need something like
@role = Role.new(:name => params[:role][:name], :company_id =>
params[:role][:company_id])

yes … I see , need to eliminate the prompt…

thanks