hello,
i''have a select box like this in my view :
<%= form_tag(:action => :build_site) %>
<% if @buildsite != nil %>
<%=
collection_select("idPage","",@listePages,"id","nom",{:selected=>@curentPage,:include_blank
=> true},{:onchange=>"this.form.submit()"}) %>
<% end %>
<%= end_form_tag %>
and my controller is :
def build_site
if params[:idPage] == nil
@curentPage = 1
else
session[:idPage] = params[:idPage]
@curentPage = params[:idPage]
end
@listePages = Page.find(:all)
end
i think it''s not the good method to have a "selected" value.
can you help me to do that ?
thanks
--
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
-~----------~----~----~----~------~----~------~--~---