2 newbie question

Hey all,
I have 2 newbie questions,

1st question:
<%= collection_select (:region, :id, @regionall, :id,
:title,options={:prompt=>"- Select cat -"}) %>
Ignores the :prompt part while options={:include_blank => true} works.
Any idea what I´m doing work with :prompt ?

2nd question:
How can make my collection_selected to display it’s third key by
default?
I know it has something to do with selected_value or selected_key but
I have no idea where to put it (html_options etc…) and how to it
works, I tried but couldn’t figure it out.

Thanx in advance

Pat

On 8/17/06, Patrick A. [email protected] wrote:

Hey all,
I have 2 newbie questions,

1st question:

Ignores the :prompt part while options={:include_blank => true} works.
Any idea what I´m doing work with :prompt ?

Did you try:
<%= collection_select (:region, :id, @regionall, :id,
:title,{:prompt=>“-
Select cat -”}) %>

I don’t think you’re supposed to write the “options =”; at least I never
do.

2nd question:

How can make my collection_selected to display it’s third key by default?
I know it has something to do with selected_value or selected_key but
I have no idea where to put it (html_options etc…) and how to it
works, I tried but couldn’t figure it out.

in your controller:
@first_option = Region.find(2)

2 being the third record, since 0 is first.

Then in your view:

<%= collection_select (:region, :id, @regionall, :id,
:title,{:prompt=>“-
Select cat -”, :selected=>@first_option}) %>

Thanx in advance