return false;
});
- // FIXME: This could be much simpler as an entityRef field but pcp doesn't have a searchable api :(
- var pcpURL = CRM.url('civicrm/ajax/rest', 'className=CRM_Contact_Page_AJAX&fnName=getPCPList&json=1&context=contact&reset=1');
- $('#pcp_made_through_id').crmSelect2({
- placeholder: {/literal}'{ts escape="js"}- select -{/ts}'{literal},
- minimumInputLength: 1,
- ajax: {
- url: pcpURL,
- data: function(term) {
- return {term: term};
- },
- results: function(response) {
- return {results: response};
- }
- },
- initSelection: function(el, callback) {
- callback({id: $(el).val(), text: $('[name=pcp_made_through]', $form).val()});
- }
- })
- // This is just a cheap trick to store the name in case of a formrule error
- .on('change', function() {
- $('[name=pcp_made_through]', $form).val($(this).select2('data').text || '');
- });
-
$('.crm-soft-credit-block tr span').each(function () {
if ($(this).hasClass('crm-error')) {
$(this).parents('tr').show();