should be trivial but I can''t figure this out from api <%= hidden_field ''certifications'', ''personnel_id'', {value #{@personnel.id}} %> I want to pass the value of ''id'' field in my form to the certifications controller as personnel_id Craig
Matthew Palmer
2006-Jun-04 14:00 UTC
[Rails] Re: passing a value in a hidden field inside a form
On Sun, Jun 04, 2006 at 06:46:09AM -0700, Craig White wrote:> should be trivial but I can''t figure this out from api > > <%= hidden_field ''certifications'', ''personnel_id'', {value > #{@personnel.id}} %>Not sure whether hidden_field is supposed to work like that, but your syntax is *way* off. Try this instead: <%= hidden_field ''certifications'', ''personnel_id'', :value => @personnel.id %> - Matt -- When I was a kid I used to pray every night for a new bicycle. Then I realised that the Lord doesn''t work that way so I stole one and asked Him to forgive me. -- Emo Philips.
Bharat Ahluwalia
2006-Jun-04 18:17 UTC
[Rails] passing a value in a hidden field inside a form
Ouch ouch, commited one of the cardinal sins. Changing subject line to the right one now Bharat> Message: 11 > Date: Sun, 4 Jun 2006 23:42:26 +0530 > From: "Bharat Ahluwalia" <bharata@aditi.com> > Subject: [Rails] RE: Rails Digest, Vol 21, Issue 64 > To: <rails@lists.rubyonrails.org> > Message-ID: > > <36A41529D41B654CAB688AF7676200EC01D0EFE2@blrsnrmsg00.aditi.tech> > Content-Type: text/plain; charset="us-ascii" > > > From: Craig White <craigwhite@azapple.com> > > Subject: [Rails] passing a value in a hidden field inside a form > > To: rails@lists.rubyonrails.org > > Mesdosage-ID: <1149428769.713.5.camel@lin-workstation.azapple.com> > > Content-Type: text/plain > > > > should be trivial but I can''t figure this out from api > > > > <%= hidden_field ''certifications'', ''personnel_id'', {value > > #{@personnel.id}} %> > > > > I want to pass the value of ''id'' field in my form to the > > certifications > > controller as personnel_id >> Not tried it myself in exactly the same scenario, but I had a similar > problem with normal text fields. Solved it by using the > following syntax > <%= hidden_field ''certifications'', ''personnel_id'', @personnel.id %> > > Hope that does the trick > > Bharat > > > ------------------------------ > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > End of Rails Digest, Vol 21, Issue 65 > ************************************* >
Craig White
2006-Jun-04 18:24 UTC
[Rails] Re: passing a value in a hidden field inside a form
On Sun, 2006-06-04 at 23:56 +1000, Matthew Palmer wrote:> On Sun, Jun 04, 2006 at 06:46:09AM -0700, Craig White wrote: > > should be trivial but I can''t figure this out from api > > > > <%= hidden_field ''certifications'', ''personnel_id'', {value > > #{@personnel.id}} %> > > Not sure whether hidden_field is supposed to work like that, but your syntax > is *way* off. Try this instead: > > <%= hidden_field ''certifications'', ''personnel_id'', :value => @personnel.id > %>---- perfect - thanks - I tried to get too complicated Craig