On 2 Sep 2008, at 09:36, Lost Warrior wrote:
>
> Hi iam using select_tag i want selected_option. i have made select
> _tag like this
>
> <%=select_tag(''name'', options_for_select({ :Relevance
>
=>''Relevant'',:Date=>''Recent''}),:selected=>params[:name].to_s)
%>
>
> The generated html look like this
>
> <select selected="Relevant" name="name"
id="name"><option
> value="Recent">Date</option>
> <option
value="Relevant">Relevance</option></select>
>
>
> How to make the selected option inside option tag
Well since selectedness is a property of an option not the select tag
as a whole it makes sense for it to be an argument to
options_for_select. Check the api for options_for_select
Fred/>
> --
> Posted via http://www.ruby-forum.com/.
>
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google
> Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
> -~----------~----~----~----~------~----~------~--~---
>