:onChange and AJAX forms


#1

Hi,

I have this:

<%= form_remote_tag (:update => “item_type_list”, :url => {:action =>
:list_item_type_for_brand}, :id => “form1”) %>

Brand <%= select :current_brand, :id, @all_brands,{},{:onchange => "submit()"} %>

<%= end_form_tag %>

which returns a list of items.

Its working when I click on the submit button, but when I use the
:onchange to submit the form, the AJAX calls is sent to a new page
insted of the

with the “item_type_list” id.

Any idea?


#2

Fixed my own problem:

add

:html => {:id => “test”}

to the form

and

:onchange => “test.onsubmit()”

for the form submition…

Super simple, as always but wasted a lot of time on it…