From b4ef2b40ff981d82582843333ec6717f5bc39fe9 Mon Sep 17 00:00:00 2001 From: Sunil Pawar Date: Mon, 14 Mar 2022 14:01:56 +0530 Subject: [PATCH] Copy Clear value in batch update process for radio button field --- templates/CRM/common/batchCopy.tpl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 -- 2.25.1