From: Sunil Pawar Date: Mon, 14 Mar 2022 08:31:56 +0000 (+0530) Subject: Copy Clear value in batch update process for radio button field X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b4ef2b40ff981d82582843333ec6717f5bc39fe9;p=civicrm-core.git Copy Clear value in batch update process for radio button field --- diff --git a/templates/CRM/common/batchCopy.tpl b/templates/CRM/common/batchCopy.tpl index a1b1201619..ee41fefde4 100644 --- a/templates/CRM/common/batchCopy.tpl +++ b/templates/CRM/common/batchCopy.tpl @@ -36,8 +36,15 @@ // select, checkbox, radio, date fields, text, textarea, multi-select // wysiwyg editor, advanced multi-select ( to do ) if ( elementType == 'radio' ) { - firstElementValue = elementId.filter(':checked').eq(0).val(); - elementId.filter("[value='" + firstElementValue + "']").prop("checked",true).change(); + var firstElementId = $('.crm-copy-fields tr:first-child [name^="field["][name*="[' + fname +']"][type!=hidden]'); + firstElementValue = firstElementId.filter(':checked').eq(0).val(); + // if radio button is uncheck then unset all the fields. + if (typeof firstElementValue == 'undefined') { + elementId.prop("checked", false).change().siblings('a.crm-clear-link').trigger('click'); + } + else { + elementId.filter("[value='" + firstElementValue + "']").prop("checked", true).change(); + } } else if ( elementType == 'checkbox' ) { // handle checkbox