cj('tr#bcc ul li:not(:last)').remove();cj('#bcc').hide();
});
- var hintText = "{/literal}{ts escape='js'}Type in a partial or complete name or email address of an existing contact.{/ts}{literal}";
- var sourceDataUrl = "{/literal}{crmURL p='civicrm/ajax/checkemail' q='id=1' h=0 }{literal}";
- var toDataUrl = "{/literal}{crmURL p='civicrm/ajax/checkemail' q='id=1' h=0 }{literal}";
+ var sourceDataUrl = "{/literal}{crmURL p='civicrm/ajax/checkemail' q='id=1' h=0 }{literal}";
+
+ function emailSelect(el, prepopulate){
+ $(el).data('api-entity', 'contact').crmSelect2({
+ minimumInputLength: 1,
+ multiple: true,
+ ajax: {
+ url: sourceDataUrl,
+ data: function(term) {
+ return {
+ name: term,
+ };
+ },
+ results: function(response) {
+ return {
+ results: response,
+ };
+ }
+ }
+ }).select2('data', prepopulate);
+ }
+ emailSelect('#to', toContact);
+ emailSelect('#cc_id', ccContact);
+ emailSelect('#bcc_id', bccContact);
+ });
+
- cj( "#to" ).tokenInput( toDataUrl, { prePopulate: toContact, theme: 'facebook', hintText: hintText });
- cj( "#cc_id" ).tokenInput( sourceDataUrl, { prePopulate: ccContact, theme: 'facebook', hintText: hintText });
- cj( "#bcc_id" ).tokenInput( sourceDataUrl, { prePopulate: bccContact, theme: 'facebook', hintText: hintText });
- cj( 'ul.token-input-list-facebook, div.token-input-dropdown-facebook' ).css( 'width', '450px' );
</script>
{/literal}
-{include file="CRM/common/formNavigate.tpl"}
{/if}
{literal}
-
- var hintText = "{/literal}{ts escape='js'}Type in a partial or complete name or email address of an existing contact.{/ts}{literal}";
- var sourceDataUrl = "{/literal}{crmURL p='civicrm/ajax/checkphone' h=0 }{literal}";
- var toDataUrl = "{/literal}{crmURL p='civicrm/ajax/checkphone' q='id=1' h=0 }{literal}";
-
- cj( "#to" ).tokenInput( toDataUrl, { prePopulate: toContact, theme: 'facebook', hintText: hintText });
- cj( 'ul.token-input-list-facebook, div.token-input-dropdown-facebook' ).css( 'width', '450px' );
+ CRM.$(function($){
+ var sourceDataUrl = "{/literal}{crmURL p='civicrm/ajax/checkphone' h=0 }{literal}";
+ function phoneSelect(el){
+ $(el).data('api-entity', 'contact').crmSelect2({
+ minimumInputLength: 1,
+ multiple: true,
+ ajax: {
+ url: sourceDataUrl,
+ data: function(term) {
+ return { name: term,};
+ },
+ results: function(response) {
+ return { results: response };
+ }
+ }
+ }).select2('data', toContact);
+ }
+ phoneSelect('#to');
+ });
</script>
{/literal}
-{include file="CRM/common/formNavigate.tpl"}