Adding things to params in a form


#1

I have a form and I am trying to get it to add another parameter without
entering it in a field.
I have the form partial _form.rhtml

<%= error_messages_for ‘response’ %>

Title
<%= text_field 'response', 'title' %>

Body
<%= text_area 'response', 'body' %>

User
<%= text_field 'response', 'user' %>

Date
<%= datetime_select 'response', 'date' %>

<%= params[:id]%>

when it goes the controller it passes all the params as
params[:response], but I want to add that params[:id] that I passed in,
I can get that to print out so I know it is there. Any suggestions?


#2

Maybe you could try,
<%= hidden_field ‘response’, ‘putyournamehere’, :value => ‘anyvalue’%>


#3

awesome, that was exactly what I was looking for. Thanks.


#4

Hi Scott,

Scott P. wrote:

I have a form and I am trying to get it to add another
parameter without entering it in a field.

hidden_field_tag might be what you’re looking for.

hth,
Bill