# Form\_tag and hidden text fields

**URL:** <https://www.ruby-forum.com/t/form-tag-and-hidden-text-fields/142819>\
**Category:** Rails\
**Created:** [July 11, 2008, 8:14pm UTC](https://www.ruby-forum.com/t/form-tag-and-hidden-text-fields/142819 "2008-07-11T20:14:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@joel](https://www.ruby-forum.com/u/joel)\
**Post date:** [July 11, 2008, 8:14pm UTC](https://www.ruby-forum.com/t/form-tag-and-hidden-text-fields/142819/1 "2008-07-11T20:14:47Z")

</div>

Hello,

while designing a form with the form\_for tag, I m not being able to  
hide my text fields. Here is an excerpt of my code :

\<% form\_for :foo, @foo, :url =\> { :controller=\>“foo”,:action =\>  
“create” } do |f| %\>

\<%= f.text\_field :user\_id, :type =\> 'hidden', :value=\>current\_user.id %\>

The hidden attribute is not being taken into consideration and my  
fields are still visible.

Can anyone help with that.

Regards,

Joel

---

<div class="post-metadata">

**Author:** ![joel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@joel](https://www.ruby-forum.com/u/joel)\
**Post date:** [July 11, 2008, 8:19pm UTC](https://www.ruby-forum.com/t/form-tag-and-hidden-text-fields/142819/2 "2008-07-11T20:19:28Z")

</div>

all you need is

\<%= f.hidden\_field\_tag ‘name’, :params[:name] %\>
