You seem to be pretty close. Have you used a tool like Firebug to inspect
the value of the hidden field?
You''re probably looking for this:
<%= f.hidden_field :patient_id, :value => @patient_id %>
with @patient_id being set to whatever value you''d like it to be
updated to.
On Mon, Jan 18, 2010 at 9:00 PM, Dudebot
<craignied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hi Gurus,
>
> I had a form with a collection
>
> <%= f.collection_select :patient_id, Patient.find_main, :id, :namer
%>
>
> Where the user selected the :patient_id. I''ve now reconfigured
the
> rails app so that the controller for this form is passed :patient_id
> in the params hash. I no longer want the user to see this selection,
> but I need to update :patient_id in the model.
>
> I first just made it disappear with
> <p id="disappear"><%= f.collection_select :patient_id,
> Patient.find_main, :id, :namer %></p>
> where
> #disappear {
> display: none;
> }
>
> But that seemed inelegant. I found hidden_field and hidden_field_tag
> in the rails docs, but can''t seem to get the right syntax. For
> example,
>
> <%= hidden_field_tag :patient_id, :patient_id %>
>
> Is not updating :patient_id in the model.
>
> Can someone give guidance on the proper usage of hidden_field/
> hidden_field_tag, or if I''m totally off base, what I should be
putting
> into the form to hide this transaction?
>
> Many TIA,
> Craig
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.