Hidden fields in forms

Please can someone show me the correct syntax for a hidden field in
forms, this is my code

<%= start_form_tag :action => ‘create’ %>

<% hidden_field ‘line_item’, ‘client_id’, :value => session[:client_id]
%>
<% hidden_field ‘line_item’, ‘product_id’, :value => 999999 %>
<% hidden_field ‘line_item’, ‘sort_key’, :value => “saa” %>
<% hidden_field ‘line_item’, ‘category’, :value => “adi” %>
<% hidden_field ‘line_item’, ‘model’, :value => “additional item” %>
<% hidden_field ‘line_item’, ‘prod_num’, :value => “999” %>
<% hidden_field ‘line_item’, ‘image_s’, :value =>
“/images/til/aditem.jpg” %>

Quantity : <%= text_field 'line_item', 'quantity' %>
Description : <%= text_area 'line_item', 'description', :cols=>"99", :rows=>"2" %>
Price : <%= text_field 'line_item', 'unit_price' %>

<%= submit_tag ‘Create Additional Item’ %>
<%= end_form_tag %>

Rails never complains but the record never appears.
If I take the “hidden_field” lines out, a record is created.

Thanks,
Paul Thompson

On Sat, 2006-07-08 at 13:25 +1200, Paul Jonathan T. wrote:

<% hidden_field ‘line_item’, ‘product_id’, :value => 999999 %>

Price Rails never complains but the record never appears. If I take the "hidden_field" lines out, a record is created.

I tend to use an “=”

<%= hidden_field …

you probably want to enclose the html in brackets…

<%= hidden_field ‘controller’, ‘column’, {:value => ‘some value’} %>
but I’m not certain that’s necessary

Craig

you’re missing the ‘=’

<%= hidden_field ‘line_item’, ‘client_id’ %>

On Fri, 2006-07-07 at 18:41 -0700, Craig W. wrote:

<% hidden_field ‘line_item’, ‘client_id’, :value => session[:client_id] %>
:cols=>“99”, :rows=>“2” %>

but I’m not certain that’s necessary


that doesn’t seem right… {value=‘some value’} seems better

Craig

Thanks for the help.

This worked:

<%= hidden_field ‘line_item’, ‘product_id’, :value => ‘999999’ %>

Craig, it did not need the curly brackets.

Thanks to all,

Paul