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