From 06d80d0e574f50d02e966a39ac45a488a3952f7c Mon Sep 17 00:00:00 2001 From: "Thomas R. Koll" Date: Tue, 28 Dec 2010 23:46:34 +0100 Subject: [PATCH] Issue #729: Failed posts and comments don't retain text The forms were cleared on a submit event instead of a ajax:success --- public/javascripts/rails.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/javascripts/rails.js b/public/javascripts/rails.js index 99e20ea8e..da50746dd 100644 --- a/public/javascripts/rails.js +++ b/public/javascripts/rails.js @@ -97,10 +97,14 @@ jQuery(function ($) { $('form[data-remote]').live('submit', function (e) { $(this).callRemote(); e.preventDefault(); - $(this).clearForm(); - $(this).focusout(); }); + $('form[data-remote]').live('ajax:success', function (e) { + $(this).clearForm(); + $(this).focusout(); + }); + + $('a[data-remote],input[data-remote]').live('click', function (e) { $(this).callRemote(); e.preventDefault();