Topic: Observe_form with select boxes and RJS

Hi,

I have a big search form that contains 3 related select boxes : country, region, area.
I need to send ALL the params form each time I change something in the form, so I used observe_form().

It's work fine and the related select boxes are displayed with RJS... here is the problem : observe_form "can't see" new form items displayed by RJS/AJAX.

So for the 2 related select boxes, I want to send the entire form as observe_form does.
Something like :

    <select name="selected_region_id" id="selected_region_id" style="width:200px;" onchange="new Ajax.Updater('', '/main/items/finder/filter', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;">

This doesn't work... I don't know why.
Notice that my form is a form_remote_tag... without any submit button.

I can't use observe_field because I need all my params in the controller as I say...

Thanks.

Last edited by hoksitan (2007-09-15 14:37:24)

Re: Observe_form with select boxes and RJS

The solution :

onchange="new Ajax.Updater('', '/main/items/finder/filter', {asynchronous:true, evalScripts:true, onLoaded:function(request){Element.hide('spinner')}, onLoading:function(request){Element.show('spinner')}, parameters:Form.serialize($('main_form'))});"

to send all the form with the new select field.