AJAX/RJS issue: observe_form not passing in form params

I have a similar problem. My form uses 3 fields: 2 selects and a text input.

when I look at the params, I get the updated version of the text input but not for the selects. For these, I keep getting the last option in the list what every I do.

I tried the :with thig and it didnt change anything.. anyone has an idea?

Cayce Balara wrote:

Hi,

I too have been hitting the problem that if you omit the :updated option in the observe_form or observe_field method, then no parameters are sent.

An example of the js with an update option included: (note parameters:value)

new Form.EventObserver('firstname', function(element, value) {new Ajax.Updater('updated_names', '/customer/live_lookup', {asynchronous:true, evalScripts:true, parameters:value})})

If the :update is removed you get (note missing params):

new Form.EventObserver('firstname', function(element, value) {new Ajax.Request('/customer/live_lookup', {asynchronous:true, evalScripts:true})})

Like you, I had been trying to use : with but was getting curious results. Thanks for your solution :with=>'valjue=value' works a treat, although I dont understand why. The js it produces is:

new Form.EventObserver('firstname', function(element, value) {new Ajax.Request('/customer/live_lookup', {asynchronous:true, evalScripts:true, parameters:value=value})})

In fact I cannot understand the api explanation of :with. I get the gist of what it does, but cannot fathom exactly how to use it. Can anyone offer an improved explanation of how to use :with ?

Thanks Tonypm