Multiple Paramters and observe_field :with

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_field+-+Passing+Parameters

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

Thanks,
David

Anybody out there?

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_field+-+Passing+Parameters

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

David

David H. 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_field+-+Passing+Parameters

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 C.man

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