title: Submit Rails from on change of selected value in dropdown form
body: <p>I have a Rails app with listing of leads in a table. In one of the collumns I display status of a lead in a drop down menu. I want to enable changing this status of the lead on changing the value selected in the drop down. </p>
  
  <p>This is what I tried:</p>
  
  <p>The code to display the form in a table cell:</p>
  
  <pre><code>      &lt;% @leads.each do |lead| %&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;%= lead.id %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;%= form_for(lead,:url =&gt; 'update_lead_status') do |f| %&gt;
                &lt;div class="field"&gt;
                  &lt;%= f.select :status, ["to_call","called","confirmed","lite"], :selected =&gt; lead.status, onchange: "this.form.submit();" %&gt;
                &lt;/div&gt;
              &lt;% end %&gt;
          &lt;/td&gt;
  </code></pre>
  
  <p>my update_lead_status method in leads controller:</p>
  
  <pre><code>#PUT
    def update_lead_status
      @lead = Lead.find(params[:id])
      respond_to do |format|
        # format.js
        if @lead.update_attributes(params[:lead])
          format.html { redirect_to leads_url, notice: 'Lead was successfully updated.' }
          format.json { head :no_content }
        else
          format.html { render action: "edit" }
          format.json { render json: @lead.errors, status: :unprocessable_entity }
        end
      end
    end
  </code></pre>
  
  <p>Also I want the submission to be Ajax style without refreshing.</p>