# Select\_month post and params

**URL:** <https://www.ruby-forum.com/t/select-month-post-and-params/153880>\
**Category:** Rails\
**Created:** [November 22, 2008, 11:19am UTC](https://www.ruby-forum.com/t/select-month-post-and-params/153880 "2008-11-22T11:19:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![chaosbanane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chaosbanane](https://www.ruby-forum.com/u/chaosbanane)\
**Post date:** [November 22, 2008, 11:19am UTC](https://www.ruby-forum.com/t/select-month-post-and-params/153880/1 "2008-11-22T11:19:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![chaosbanane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chaosbanane](https://www.ruby-forum.com/u/chaosbanane)\
**Post date:** [November 22, 2008, 4:18pm UTC](https://www.ruby-forum.com/t/select-month-post-and-params/153880/2 "2008-11-22T16:18:17Z")

</div>

The redirect should be the last statement.

On 11/22/08, Andi G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> month = params[:month_select]
> 
> ```
> 
> ## \<%form\_tag :action =\> “bla” do %\> Greetings, Andi
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–

–  
James M.

---

<div class="post-metadata">

**Author:** ![chaosbanane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chaosbanane](https://www.ruby-forum.com/u/chaosbanane)\
**Post date:** [November 22, 2008, 4:30pm UTC](https://www.ruby-forum.com/t/select-month-post-and-params/153880/3 "2008-11-22T16:30:48Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![chaosbanane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chaosbanane](https://www.ruby-forum.com/u/chaosbanane)\
**Post date:** [November 22, 2008, 5:26pm UTC](https://www.ruby-forum.com/t/select-month-post-and-params/153880/4 "2008-11-22T17:26:55Z")

</div>

On Nov 22, 3:30 pm, Andi G. [removed\_email\_address@domain.invalid](mailto: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

---

<div class="post-metadata">

**Author:** ![chaosbanane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chaosbanane](https://www.ruby-forum.com/u/chaosbanane)\
**Post date:** [November 22, 2008, 5:44pm UTC](https://www.ruby-forum.com/t/select-month-post-and-params/153880/5 "2008-11-22T17:44:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![chaosbanane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chaosbanane](https://www.ruby-forum.com/u/chaosbanane)\
**Post date:** [November 22, 2008, 6:26pm UTC](https://www.ruby-forum.com/t/select-month-post-and-params/153880/6 "2008-11-22T18:26:42Z")

</div>

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 🙂

this is from this log:

“date”=\>{“month\_select”=\>“11”, “year\_select”=\>“2008”}

how can i params the month\_select?

---

<div class="post-metadata">

**Author:** ![chaosbanane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chaosbanane](https://www.ruby-forum.com/u/chaosbanane)\
**Post date:** [November 22, 2008, 6:39pm UTC](https://www.ruby-forum.com/t/select-month-post-and-params/153880/7 "2008-11-22T18:39:30Z")

</div>

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 😉
