Forum: Ruby on Rails Multiple Paramters and observe_field :with

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Fa06489a97b0efe3c3b7d249982878d3?d=identicon&s=25 David Hughes (divotdave)
on 2006-04-15 08:42
Hi All:

I have searched high and low with no success. Does anyone know of a way
to pass the values of more than one form field through the :with
parameter of observe_field?

Basically I have two fields on the form with number values. When the
user changes the value of one I would like to send the values of both
fields to the controller for calculations and return the result to the
user on the form. If I only pass one of the fields (i.e.
"'volume='+value") I can get a respnse back to the form, so I am pretty
sure all my code is good...

I also looked into observe_form but couldn't get the Form.serialize
thing to work. I only want to pass the two values, not the entire form
which has a considerable amount of inputs on it anyway.

I did find a hint on the Rails wiki:
http://wiki.rubyonrails.org/rails/pages/observe_fi...

Though despite my efforts to copy the syntax given in the example, I
couldn't get it to work either. Any ideas?

Thanks,
David
Fa06489a97b0efe3c3b7d249982878d3?d=identicon&s=25 David Hughes (divotdave)
on 2006-04-16 17:53
Anybody out there?
Fa06489a97b0efe3c3b7d249982878d3?d=identicon&s=25 David Hughes (divotdave)
on 2006-04-18 04:55
Hello:

Just in case someone ever reads this...I found a solution, which you can
see on the Rails wiki:
http://wiki.rubyonrails.org/rails/pages/observe_fi...

The solution involved concatenating a string of values from various form
feilds using the $F function from the Prototype library. Good Luck...

David
59ea1b450935b9d70abfec4186b7a4d5?d=identicon&s=25 Jeff Coleman (progressions)
on 2006-04-18 04:55
David Hughes wrote:
> Hello:
>
> Just in case someone ever reads this...I found a solution, which you can
> see on the Rails wiki:
> http://wiki.rubyonrails.org/rails/pages/observe_fi...
>
> The solution involved concatenating a string of values from various form
> feilds using the $F function from the Prototype library. Good Luck...
>
> David

Why not use observe_form?

It will monitor all the fields in your form, and you can act only in the
specific cases you need to process.

Jeff Coleman
This topic is locked and can not be replied to.