hidden fields

Similar (but different) to another thread called 'accessing post array', I have some records that I need sent via an array but I don't want to use a text field but rather a hidden field because I don't want them tampered with.

Simplifying my form quite a bit...

  <% form_for :supptrans, @supptrans, :url => { :action => "print_checks" } do |form| %> <table cellpadding="3" cellspacing="3" border="0" width="100%"> ...   <tbody> ...     <tr valign="top" class="ListLine<%= odd_or_even %>">       <td><%=h (check_due.supplier.suppname) %></td>       <td><%=h (check_due.suppreference) %></td>   <%= form.hidden_field :paid_invoices, {:value => check_due.id} %>   <%= text_field 'check_number', 'check_number', :size => '8' %>   <%= submit_tag 'Print Checks' %> <% end %>

where I need the form to submit the starting check number but I also need the check_due.id in an array so I know which checks are going to be printed.

this   <%= form.hidden_field :paid_invoices, {:value => check_due.id} %> is only the latest attempt but I have tried many things including...   <%= hidden_field :paid_invoices, "paid_invoices", {:value => check_due.id} %>

but none of them will give me an array of 'paid_invoices' that I will be able to parse later similar to   <%= check_box_tag 'paid_invoices', 'paid_invoices', false %> would give me

Is there a way to popular an array of 'hidden_field' elements for posting?


Craig White wrote: > ... because I don't want them tampered with. >

Then keep that info server-side.

You could go with active_record_store for your session data.

Check out ActionController::Base at http://api.rubyonrails.org/