CRM-17425 CiviContribute: add contrib form error if blanking out PCP
authorAndrew Hunt <andrew@aghstrategies.com>
Tue, 20 Oct 2015 16:51:24 +0000 (12:51 -0400)
committerAndrew Hunt <andrew@aghstrategies.com>
Tue, 20 Oct 2015 16:51:24 +0000 (12:51 -0400)
----------------------------------------
* CRM-17425: Allow PCP selection in contribution batch entry
  https://issues.civicrm.org/jira/browse/CRM-17425

templates/CRM/Contribute/Form/PCP.js.tpl

index 5d81d64dffb2ab551eac5cc25c917a804817fa4d..6a5a707511b53ccdd2649a5dc37f3bf93fbc0d28 100644 (file)
     })
       // 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);
       });
   });
 </script>