Merge pull request #3601 from atif-shaikh/CRM-14942
[civicrm-core.git] / templates / CRM / common / TabHeader.js
index e923eed2a7d875a2b5a2d8cf8c4234f584856277..82c19815e039c202bb7e671862d2df45570e7fa1 100644 (file)
@@ -9,8 +9,8 @@ CRM.$(function($) {
   tabSettings.active = tabSettings.active ? $('#tab_' + tabSettings.active).prevAll().length : 0;
   $("#mainTabContainer")
     .on('tabsbeforeactivate', function(e, ui) {
-      // Warn of unsaved changes - requires formNavigate.tpl to be included in each tab
-      if (CRM.utils.initialValueChanged(ui.oldPanel)) {
+      // CRM-14353 - Warn of unsaved changes for all forms except those which have opted out
+      if (CRM.utils.initialValueChanged($('form:not([data-warn-changes=false])', ui.oldPanel))) {
         CRM.alert(ts('Your changes in the <em>%1</em> tab have not been saved.', {1: ui.oldTab.text()}), ts('Unsaved Changes'), 'warning');
       }
     })