Form_tag and hidden text fields

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

all you need is

<%= f.hidden_field_tag ‘name’, :params[:name] %>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs