Select tags and variables

Is there a way to make pass a variable into a select tag so that the
prompt would show that value.

In other words if my select was being pulled from a table could I say
something like this:

@mystate = “New York”

select(:state, :id @states, :prompt => @mystate)

Any possibility ?

TIA
Stuart

On Sat, 2006-09-30 at 11:11 -0600, Dark A. wrote:

Any possibility ?


if your controller does something like…

@my_model.new
@my_model.state = “New York”

then your select already has the default value

If you do a collect for @states, you still have a selection list but
with a default value already entered…

State:

<%= options = [[‘Select’, ‘’]] + @states.collect {
|st| [st.list_value] }
select ‘my_model’, ‘state’, options %>

Craig