From d2e9fece1af0d3dfee66398a7e4d309d5d63547c Mon Sep 17 00:00:00 2001 From: Andrew Hunt Date: Tue, 20 Oct 2015 12:51:24 -0400 Subject: [PATCH] CRM-17425 CiviContribute: add contrib form error if blanking out PCP ---------------------------------------- * CRM-17425: Allow PCP selection in contribution batch entry https://issues.civicrm.org/jira/browse/CRM-17425 --- templates/CRM/Contribute/Form/PCP.js.tpl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/templates/CRM/Contribute/Form/PCP.js.tpl b/templates/CRM/Contribute/Form/PCP.js.tpl index 5d81d64dff..6a5a707511 100644 --- a/templates/CRM/Contribute/Form/PCP.js.tpl +++ b/templates/CRM/Contribute/Form/PCP.js.tpl @@ -47,7 +47,11 @@ }) // This is just a cheap trick to store the name when the form reloads .on('change', function() { - $('[name=pcp_made_through]', $form).val($(this).select2('data').text || ''); + var fieldNameVal = $(this).select2('data'); + if (!fieldNameVal) { + fieldNameVal = ''; + } + $('[name=pcp_made_through]', $form).val(fieldNameVal.text); }); }); -- 2.25.1