Forum: Ruby on Rails onchange inside form_remote_tag

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.
adam (Guest)
on 2005-11-12 12:49
(Received via mailing list)
What is the correct way to use an onchange inside a <select> of  a <%=
form_remote_tag %> block ?

When i do  <select name=field onchange="this.form.submit()"> it does not
update the DOM element, but posts to a new page.  A normal submit button
however works.  Is there a proper way to have this form_remote submit
with an onchange ?

pmr16366 (Guest)
on 2005-11-12 12:49
(Received via mailing list)
I had the same problem. My rather ugly workaround was to put the form
button inside a hidden div and have the onchange click the button.
 I remember reading another way of doing it too, but cant remember what.
bruno.celeste (Guest)
on 2005-11-12 12:49
(Received via mailing list)
I resolved this problem in a rails app, it's not pretty but I didn't
find a better solution ;)

<select name="actions"
<option value="1">1</option>
<input type="submit" id="submitchangeitem" value="Change!" />

Hope it helps!

2005/11/8, Paul Rogers <>:
adam (Guest)
on 2005-11-12 12:49
(Received via mailing list)
that worked thanks.

i did it like this

  <select onchange="document.getElementById
('submit_location_id').click();" id=location_id name=location_id>
   <span style="display:none;"><input type=submit
This topic is locked and can not be replied to.