Observe_field and update

Hi everyone,

I have a select box with an observe field; i update another select box
on first ones change. Is there a way to update more than one select
box on change. I need to update 2 select boxes based on the selection
of the first one. Any input is appreciated

Thank you,

can you paste some of your code?

Hi,

I have a select box with an observe field; i update another select box
on first ones change. Is there a way to update more than one select
box on change. I need to update 2 select boxes based on the selection
of the first one. Any input is appreciated

sure you can do that. When you call observe_field you usually have the
:update parameter filled in, which means “write the return of the action
to the element with this id”.

when you want to update multiple elements with an ajax call, what you do
is just not provide an :update parameter.

That way, the ajax called is managed in a slightly different way. In
that case, you will have in your rjs (or in your action by using render
:update) an object called “page” which represents your document object
in javascript.

you could do something like
page.replace_html id_of_the_first_dependant_box, :partial=>whatever
page.replace_html id_of_the_second_dependant_box,
:partial=>whatever

regards,

javier ramirez

Estamos de estreno… si necesitas llevar el control de tus gastos
visita http://www.gastosgem.com !!Es gratis!!