select_month post and params

Hi

why is that not working?

Controller-----------------------------------------------------

def bla

      month = params[:month_select]

      redirect_to :action => "index"
      flash[:error_messages_for] = month.to_s

end

View----------------------------------------------------------

<%form_tag :action => "bla" do %>

  <%= select_month(Date.today, :field_name => 'month_select') %>
  <%= submit_tag "Jump" %>

<% end %>

The redirect should be the last statement.

hi

thanks for the answer!

this is not the problem. The notice will be shown up on the index.

The problem is that the post is empty. If i exchange the select_month
with select_date the post work out.

for example:

I choose the date: 22.11.2008 the result is: month11day22year2008 (i am
not sure about the order)

Other ideas?

Check your logs to see under what name the parameter arrives (or look
at the rendered html)

Fred

Andi Geheim wrote:

Check your logs to see under what name the parameter arrives (or look
at the rendered html)

Where are those logfiles? in the rendered html it is correct i think:
name="date[month_select]"

Ah okay i know what logfile you mean :slight_smile:

this is from this log:

"date"=>{"month_select"=>"11", "year_select"=>"2008"}

how can i params the month_select?

sorry for the soliloquy.

this is the solution:

<%= select_month(Date.today, :prefix => 'month_select', :field_name =>
'') %>

prefix is the right option -> params[:month_select]
the field_name option is an extension befor the name ->
if you select the november as month the value is field_name + month,
default is "month".

thanks and cya :wink: