CRM-14336 - Clear up potential memory leaks from ajaxForm
authorColeman Watts <coleman@civicrm.org>
Tue, 11 Mar 2014 18:35:49 +0000 (14:35 -0400)
committerColeman Watts <coleman@civicrm.org>
Tue, 11 Mar 2014 18:35:49 +0000 (14:35 -0400)
templates/CRM/Contact/Page/View/Summary.js

index 82a46c4ce61345951aced76ef770106257e0c25e..e8c76d22d9fcd424d556433510f4a0ac18769d75 100644 (file)
@@ -43,6 +43,7 @@
 
   function requestHandler(response) {
     var o = $('div.crm-inline-edit.form');
+    $('form', o).ajaxFormUnbind();
 
     if (response.status == 'save' || response.status == 'cancel') {
       o.trigger('crmFormSuccess', [response]);
     }
     else {
       // Handle formRule error
-      $('form', o).ajaxForm('destroy');
       $('.crm-container-snippet', o).replaceWith(response.content);
       $('form', o).validate(CRM.validate.params);
       $('form', o).ajaxForm(ajaxFormParams);
       // Inline edit form cancel button
       .on('click', '.crm-inline-edit :submit[name$=cancel]', function() {
         var container = $(this).closest('.crm-inline-edit.form');
+        $('form', container).ajaxFormUnbind();
         $('.inline-edit-hidden-content', container).nextAll().remove();
         $('.inline-edit-hidden-content > *:first-child', container).unwrap();
         container.removeClass('form');