Can anyone tell me how to use form field values on a different part of your form? Example If I have a value being retrieved from the DB like this: <td><%=h number.m1 %></td> how do I take that value and do something like this: <td><%=h number.m1 %></td> X 25 Where I multiple the value retrived by 25 and display it in a new TD Thanks -- Posted via http://www.ruby-forum.com/.
I''m not sure I understand, but I would guess the answer is: <td><%=h number.m1 * 25 %></td> On Mon, Jul 27, 2009 at 4:26 PM, Mark Preston < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Can anyone tell me how to use form field values on a different part of > your form? > > Example > > If I have a value being retrieved from the DB like this: > > <td><%=h number.m1 %></td> > > > how do I take that value and do something like this: > > <td><%=h number.m1 %></td> X 25 > > Where I multiple the value retrived by 25 and display it in a new TD > > Thanks > -- > Posted via http://www.ruby-forum.com/. > > > >-- ====================Jim http://www.thepeoplesfeed.com/contribute --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
James Englert wrote:> I''m not sure I understand, but I would guess the answer is: > > <td><%=h number.m1 * 25 %></td> > > On Mon, Jul 27, 2009 at 4:26 PM, Mark Preston < > rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> >> > >> > > > -- > ====================> Jim > http://www.thepeoplesfeed.com/contributeThanks for the reply, what I am trying to do is take the value from <td><%=h number.m1 %></td> and do this: <td> ref to td above X 25</td> I don''t know how to reference the results from the first td in order to do the math I want to in a different td. I hope I made a little more sense. Thanks -- Posted via http://www.ruby-forum.com/.
On Mon, Jul 27, 2009 at 1:53 PM, Mark Preston<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> ... what I am trying to do is take the value from > > <td><%=h number.m1 %></td> and do this: > > <td> ref to td above X 25</td> > > I don''t know how to reference the results from the first td in order to > do the math I want to in a different td. > > I hope I made a little more sense.Not really. You''re not doing *anything* "in a td" -- you''re generating markup in a view (unless you''re trying to describe using JavaScript to interactively set this value in the client). number.m1 is the same no matter where you refer to it in any given page, so what was already suggested is exactly right: <td><%=h number.m1 %></td> <td><%=h number.m1 * 25 %></td> If that''s not the answer, please try to explain what you want to do a little more clearly. -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan