On 8/17/06, Patrick Aljord <patcito@gmail.com>
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>
> Pat
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
--
"Impossible is nothing."
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060817/40ee5c2d/attachment-0001.html