Forum: Ruby on Rails :onChange and AJAX forms

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Alain P. (Guest)
on 2006-06-06 03:55

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()"} %>
    <input type="submit" value="Change" />

<%= 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 <div> with the  "item_type_list" id.

Any idea?
Alain P. (Guest)
on 2006-06-06 04:57
Fixed my own problem:


:html => {:id  => "test"}

to the form


:onchange => "test.onsubmit()"

for the form submition...

Super simple, as always but wasted a lot of time on it...
This topic is locked and can not be replied to.