hidden_field
![Extensive documentation Importance_4](https://d2vfyqvduarcvs.cloudfront.net/images/importance_4.png?1349367920)
hidden_field(object, method, options = {})
public
Works just like text_field, but returns an input tag of the "hidden" type instead.
![Default_avatar_30](https://www.gravatar.com/avatar/c4c2402d8b101ccbc9747b2fb45cd7df?size=30&default=http://apidock.com/images/default_avatar_30.png)
Value parameter
You can add a value to your hidden field by using the :value parameter.
Example
hidden_field(:object, :field, :value => params[:requestval])
![Default_avatar_30](https://www.gravatar.com/avatar/682233f4f5b894b2d328b0c98d0d7582?size=30&default=http://apidock.com/images/default_avatar_30.png)
No security
One important thing to remember is that this is NOT hidden in the source code and can be modified by an evil user so all input in a hidden field should be considered as untrustworthy and checked just like a visible field.
![Default_avatar_30](https://www.gravatar.com/avatar/e592374400b28da11c2bb03d163a09a1?size=30&default=http://apidock.com/images/default_avatar_30.png)
Hidden Field Example
Here’s a pseudo code example of a hidden field within an ERB template. A post has many comments and this comment form is in a post’s show view. This would set a comment’s post_id attribute.
<%= form_for(@comment) do |f| %>
<%= f.hidden_field :post_id, :value => @post.id %>
<% end %>