I have the following date_select
, which displays three drop-down menus, from which I can select the month, day, and year.
<%=date_select("dateName", "dateMethod", :order => [:month, :day, :year])%>
I don't know how to pass the parameters to the next page. How can I pass the month, day and year with a submit_tag
or a link_to
? I am in a view page named generateDataForReport
, and I want to catch the parameters in another view under the same controller named showGeneratedReport
.
If you look at your console when you submit the form, you can see how these parameters are named:
In your controller, you can grab the parameters like this:
Year:
Month:
Day:
You can assign them to variables in your controller to make them easier to deal with:
If you want to pass these params to your next page, then do this in your redirect:
Now on the next page, your URL should look something like this showing your params:
Now to display them on the page you do this: