I have a form that looks like the following
<%= form_remote_tag
:url=>{:controller=>"note",:action=>"create_with_ajax"},
:update=>"notes#{servicerequest.id}", :position=>
"bottom"
%>
Note : <textarea rows="2" cols="20"
name="notes[text]"></textarea>
<input type="hidden" name="notes[site_id]"
value="<%=servicerequest.site.id%>">
<input type="hidden" name="notes[servicerequest_id]"
value="<%=servicerequest.id%>">
<input type="submit" name="submit"
id="form-submit-button<%=servicerequest.id%>" value="Add
note"
class="button" />
<%= end_form_tag %>
It currently does a remote call to my notes controller, creates a new
note, and adds it to the bottom of the notes list. This works fine.
Now I would like to add the additional behavior that it not only adds
the note but updates a div on the page that is a counter for how many
notes there are.
So before the call the text in the other div would be "Notes(4)" and
after the call it needs to be "Notes(5)". I know how to do this if it
is the only thing the form had to do but I am unsure of how to achieve
this functionality if the form is already making one ajax call.
So my question is basically how can I make one form do two different
ajax calls?
Thank you,
Matthew Margolis