diff --git a/CRM/Batch/Form/Entry.php b/CRM/Batch/Form/Entry.php index 55860d91b5eb6ec7f7ee939366fea7d067b50e2a..a13d974ed2d7b11dcce0b5ea23c62f237214542d 100644 --- a/CRM/Batch/Form/Entry.php +++ b/CRM/Batch/Form/Entry.php @@ -178,7 +178,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { $contactTypes = array('Contact', 'Individual', 'Household', 'Organization'); for ($rowNumber = 1; $rowNumber <= $this->_batchInfo['item_count']; $rowNumber++) { - CRM_Contact_Form_NewContact::buildQuickForm($this, $rowNumber, NULL, TRUE, 'primary_'); + CRM_Contact_Form_NewContact::buildQuickForm($this, $rowNumber, NULL, TRUE, 'primary_', ts('Contact')); // special field specific to membership batch udpate if ($this->_batchInfo['type_id'] == 2) { diff --git a/CRM/Contact/Form/NewContact.php b/CRM/Contact/Form/NewContact.php index 2c4a0e43ee3d488225269f2dabfd469482cc8378..c60242ea6402077bfb74bfcce1f22fdab6bca19b 100644 --- a/CRM/Contact/Form/NewContact.php +++ b/CRM/Contact/Form/NewContact.php @@ -50,11 +50,15 @@ class CRM_Contact_Form_NewContact { * * @return void */ - static function buildQuickForm(&$form, $blockNo = 1, $extraProfiles = NULL, $required = FALSE, $prefix = '') { + static function buildQuickForm(&$form, $blockNo = 1, $extraProfiles = NULL, $required = FALSE, $prefix = '', $label = NULL) { // call to build contact autocomplete $attributes = array('width' => '200px'); - $selectContacts = $form->add('text', "{$prefix}contact[{$blockNo}]", ts('Select Contact'), $attributes, $required); + if (!$label) { + $label = ts('Select Contact'); + } + + $selectContacts = $form->add('text', "{$prefix}contact[{$blockNo}]", $label, $attributes, $required); // use submitted values to set default if form submit fails dues to form rules if ($selectContacts->getValue()) { diff --git a/js/Common.js b/js/Common.js index c9f76c912aa0a061c1953d69f6d4b008d095061c..e2382e29a7551410214cdbbce6f9fcf4b141d13c 100644 --- a/js/Common.js +++ b/js/Common.js @@ -754,7 +754,9 @@ CRM.validate = CRM.validate || { }); // Handle qf form errors $('form :input.error', this).one('blur', function() { - $('.ui-notify-message.error a.ui-notify-close').click(); + if ($(this).is('.ac_input')) { + return; + } $(this).removeClass('error'); $(this).next('span.crm-error').remove(); $('label[for="' + $(this).attr('name') + '"], label[for="' + $(this).attr('id') + '"]') diff --git a/templates/CRM/Batch/Form/Entry.tpl b/templates/CRM/Batch/Form/Entry.tpl index 03f5135a979755845f38dc5861347e94e2574fee..a3f86cedf97f6a9096dd2fdd645c805d05614bc2 100644 --- a/templates/CRM/Batch/Form/Entry.tpl +++ b/templates/CRM/Batch/Form/Entry.tpl @@ -109,7 +109,9 @@ cj(function () { }; cj("#Entry").ajaxSubmit(options); + }); + cj('#crm-container').on('keyup change', '*.selector-rows', function () { // validate rows checkColumns(cj(this)); }); @@ -212,10 +214,15 @@ function checkColumns(parentRow) { inValidRow++; } else { - if (cj(this).val() && !cj('input[name="primary_contact_select_id[' + rowID + ']"]').val()) { + var contactIdElement = cj('input[name="primary_contact_select_id[' + rowID + ']"]'); + if (cj(this).val() && !contactIdElement.val()) { inValidRow++; errorExists = true; } + else if (cj(this).val() && contactIdElement.val()) { + // this is hack to remove error span because we are skipping this for autocomplete fields + cj(this).next('span.crm-error').remove(); + } } } else { @@ -223,7 +230,7 @@ function checkColumns(parentRow) { inValidRow++; } else { - if (cj(this).hasClass('error') && !cj(this).hasClass('valid')) { + if (cj(this).hasClass('error') && (cj(this).hasClass('valid') || cj(this).hasClass('required'))) { errorExists = true; } else {