Using form values

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:

<%=h number.m1 %>

how do I take that value and do something like this:

<%=h number.m1 %> X 25

Where I multiple the value retrived by 25 and display it in a new TD

Thanks

I’m not sure I understand, but I would guess the answer is:

<%=h number.m1 * 25 %>

On Mon, Jul 27, 2009 at 4:26 PM, Mark P. <
[email protected]> wrote:

Jim
http://www.thepeoplesfeed.com/contribute

James E. wrote:

I’m not sure I understand, but I would guess the answer is:

<%=h number.m1 * 25 %>

On Mon, Jul 27, 2009 at 4:26 PM, Mark P. <
[email protected]> wrote:

Jim
http://www.thepeoplesfeed.com/contribute

Thanks for the reply, what I am trying to do is take the value from

<%=h number.m1 %> and do this: ref to td above X 25

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

On Mon, Jul 27, 2009 at 1:53 PM, Mark
Preston[email protected] wrote:

… what I am trying to do is take the value from

<%=h number.m1 %> and do this: ref to td above X 25

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:

<%=h number.m1 %> <%=h number.m1 * 25 %>

If that’s not the answer, please try to explain what you want to do a
little more clearly.


Hassan S. ------------------------ [email protected]
twitter: @hassan

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs