Merge pull request #3367 from kirkatcaat/empty-labels-on-profile-fields
[civicrm-core.git] / js / Common.js
index 8a385fb1323909c58a960e235bceca6f83bf24b3..68b06ce38d34170cb91934de71828576c863bec5 100644 (file)
@@ -247,7 +247,8 @@ CRM.validate = CRM.validate || {
     var isDirty = false;
     $(':input:visible, :input.select2-offscreen', el).each(function () {
       var initialValue = $(this).data('crm-initial-value');
-      if (initialValue !== undefined && initialValue != $(this).val()) {
+      // skip change of value for submit buttons
+      if (initialValue !== undefined && !$(this).hasClass('form-submit') && initialValue != $(this).val()) {
         isDirty = true;
       }
     });
@@ -451,6 +452,13 @@ CRM.validate = CRM.validate || {
   // Initialize widgets
   $(document)
     .on('crmLoad', function(e) {
+      $('table.form-layout-compressed')
+        .on('change', 'input.select-rows', function () {
+          if ($(this).prop('checked')) {
+            $('input#toggleSelect:checked').prop('checked', false);
+            $('input.select-row:checked').prop('checked', false);
+          }
+         })
       $('table.row-highlight', e.target)
         .off('.rowHighlight')
         .on('change.rowHighlight', 'input.select-row, input.select-rows', function (e, data) {
@@ -464,6 +472,9 @@ CRM.validate = CRM.validate || {
             if (data !== 'master-selected') {
               $('input.select-rows', $table).prop('checked', $(".select-row:not(':checked')", $table).length < 1);
             }
+           if ($(this).prop('checked')) {
+             $('input[value=ts_sel]:radio').prop('checked', true);
+           }
           }
         })
         .find('input.select-row:checked').parents('tr').addClass('crm-row-selected');