Topic: Submit action on select

I'd like to skip the usual tedium of having to press a submit button for certain tasks.

One of these tasks is assigning categories to articles. How do I hook the onchange event so that it will send the params directly to the controller action (saving and redirecting all in one shot) ?

Re: Submit action on select

Wrap the select in a form pointing to the action, then:

<form id="form_id">
  <select onchange="$('form_id').submit()">
  ... options ...
</form>

(Assumes prototype)

Toby Hede
===================================================
FiniteStateMachine - Software Development for Social Networks
===================================================

Re: Submit action on select

one more suggestion

<form id="form_id">
<%= select("model","field",['abc','pqr','xyz'].collect{|m|[ m ]},
         options={},{:onchange =>"$('form_id').submit()"}) -%>
</form>

And also you can put an ajax call without form submission.

Last edited by virajt (2007-09-04 07:39:56)