please know that the :method => :put is in there to send the request
to my RESTful update method. When i change the text area it does in
fact submit the form, but not through AJAX. Instead it sends it as a
normal html form and ignores the onsubmit attribute which reads:
Ive tried using the observe_form helper and it behaves the same way.
The only way i can have it submit through AJAX is by using a submit
button. How can i submit the remote_form_for form via javascript and
have it still perform the AJAX request?
This is not a rails problem nor a problem in your code. There is
browser non-compliance to the submit() action which Steve Nyholm has
documented here, http://blogs.vertigosoftware.com/snyholm/archive/2006/09/27/3788.aspx,
so what occurs is submit() does not call the onsubmit event handler
that the ajax request is bound to.
I can see two potential solutions to this
(1) do not call form.submit but instead generate the ajax on your own
with something such as,
"#{remote_function(:url =>user_performance_goal_path(@user.account,
@user, @performance_goal))}; return false;"
(2) explicitly call the forms onsubmit event handler with some
javascript
The problem with solution (1) is that this WILL NOT serialize your
form elements, which is general something you want and often something
you need. To serialize your form elements use the following,
"#{remote_function(:url =>user_performance_goal_path(@user.account,
@user, @performance_goal), :with => "Form.serialize(form)" )}; return
false;"