Value for Select

Hi

how can i define a preselct value for the Select Tag?

<%= select(:bla, :bla_id, @blaa.collect {|c| [c.name, c.id]}, { :selected => '2' } ) %>

Where is the mistake?

greetings, chaos

Hi

how can i define a preselct value for the Select Tag?

<%= select(:bla, :bla_id, @blaa.collect {|c| [c.name, c.id]}, { :selected => '2' } ) %>

Where is the mistake?

:selected => 2

Fred

Andi Geheim wrote:

Hi

how can i define a preselct value for the Select Tag?

<%= select(:bla, :bla_id, @blaa.collect {|c| [c.name, c.id]}, { :selected => '2' } ) %>

Where is the mistake?

greetings, chaos

have you tried putting the :selected value as an integer? I imagine it needs to match the exact value of c.id to work.

<%= select(:bla, :bla_id, @blaa.collect {|c| [c.name, c.id]},       {:selected => 2 } ) %>

Frederick Cheung wrote:

:selected => 2

Fred

Dang... should have answered quicker.