----------------------------------------
* CRM-17425: Allow PCP selection in contribution batch entry
https://issues.civicrm.org/jira/browse/CRM-17425
})
// 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>