Select_month post and params


#1

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 notice is empty after the post.

Greetings, Andi


#2

The redirect should be the last statement.

On 11/22/08, Andi G. removed_email_address@domain.invalid wrote:

  month = params[:month_select]

<%form_tag :action => “bla” do %>
Greetings, Andi

Posted via http://www.ruby-forum.com/.


James M.


#3

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?


#4

On Nov 22, 3:30 pm, Andi G. removed_email_address@domain.invalid
wrote:

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.

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

Fred


#5

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]”


#6

Andi G. 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?


#7

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: