detect repeat configuration changes
authorunknown <priyanka.karan26@gmail.com>
Mon, 13 Oct 2014 20:22:54 +0000 (21:22 +0100)
committerunknown <priyanka.karan26@gmail.com>
Mon, 13 Oct 2014 20:22:54 +0000 (21:22 +0100)
templates/CRM/Core/Form/RecurringEntity.tpl

index 0c742e42c1d1b20251919ebd4d968b8c8c18377c..985f2b39e39985a2fb190ef28f857b1c2731aadf 100644 (file)
       }
         
     });
-        
+    
+    //Detect changes in Repeat configuration field
+    var unsavedChanges = false;
+    cj('div.crm-core-form-recurringentity-block').on('change', function() {
+      unsavedChanges = true;
+    });
+    
+    //If there are changes in repeat configuration enable save button
     //Dialog for preview repeat Configuration dates
     cj('#preview-dialog').dialog({ autoOpen: false });
     cj('#_qf_Repeat_submit-top, #_qf_Repeat_submit-bottom, #_qf_Activity_upload-top, #_qf_Activity_upload-bottom').click( function (e) {
+      if (unsavedChanges) {
       e.preventDefault();
       cj('#exclude_date_list option').attr('selected',true);
       //Copy exclude dates
         }
       });
       return false;
-    });
+      }
+      else {
+        alert("No changes to save");
+        return false;
+      }
+      });
     
     //Build Summary
     var finalSummary = '';