Comments on: Email AutoComplete (using jQuery)http://sfdc.arrowpointe.com/2011/11/18/email-autocomplete-using-jquery/
Authored by Scott Hemmeter of Arrowpointe Corp, this blog is written from the perspective of a Salesforce.com solution provider and contains information on Arrowpointe's AppExchange products as well as tips, findings, sample code, functionality wishes, etc.Fri, 31 Jan 2014 13:44:47 +0000hourly1https://wordpress.org/?v=4.4.17By: Paulhttp://sfdc.arrowpointe.com/2011/11/18/email-autocomplete-using-jquery/comment-page-1/#comment-67083
Mon, 12 Aug 2013 18:09:07 +0000http://sfdc.arrowpointe.com/?p=930#comment-67083Yeah, and those were very helpful – I left those in there so it works for those standard pages as well as any visualforce pages that I develop.

Finally, auto-complete will be on all pages where users can send emails.

I like your class selection approach best for custom pages. Nice job! The ones I was dealing with were Salesforce default ones and one from a AppExchange app, so I could not edit the HTML to get the classes in there.

]]>By: Paulhttp://sfdc.arrowpointe.com/2011/11/18/email-autocomplete-using-jquery/comment-page-1/#comment-67081
Mon, 12 Aug 2013 18:01:03 +0000http://sfdc.arrowpointe.com/?p=930#comment-67081For the sake of time and my lack of javascript experience I added another section after the for loop with this:

var Elements = document.querySelectorAll(‘.EmailAutocomplete’);
var thisElem = Elements[0];
$_org(thisElem).autocomplete({
// Everything after here is the same as inside of the loop of indexes

Obviously this only gets the first item that has the Autocomplete class, but that is all I need for now.
Now I can add the EmailAutocomplete task to any visualforce page and it’ll add autocomplete functionality!

Thanks for doing the hard part!

]]>By: Scott Hemmeterhttp://sfdc.arrowpointe.com/2011/11/18/email-autocomplete-using-jquery/comment-page-1/#comment-67080
Mon, 12 Aug 2013 17:49:28 +0000http://sfdc.arrowpointe.com/?p=930#comment-67080Paul, the key is the line that says

var thisElem = document.getElementById(elems[index]);

That is looking for the element using its index. If you use classes instead, you’d go about determining thisElem using jQuery’s class selectors.

]]>By: Paulhttp://sfdc.arrowpointe.com/2011/11/18/email-autocomplete-using-jquery/comment-page-1/#comment-67079
Mon, 12 Aug 2013 17:29:38 +0000http://sfdc.arrowpointe.com/?p=930#comment-67079I’ve set this up in a dev org and it works great for the send email page in Salesforce. I’m trying to add it to a custom visualforce page and avoid using the ID, since the ID of the field could change if I move it around on the visualforce page (thanks to visualforce’s strange automatic IDs).

How do I change it so that it could select using classes instead? I’ve tried the following but I’m getting a DOM Exception 12.

Also, for
elems.push(‘pg:addCommentF:addCommentPB:emailCustomerPBS:additionalEmailsPBSI:additionalEmails_TextBox’);

Obviously I would have to change this to the form field in my page. But why is the string so long. Could you just enter the control Id?

]]>By: Force Feed 11-21-2011 | Delivered Innovation Bloghttp://sfdc.arrowpointe.com/2011/11/18/email-autocomplete-using-jquery/comment-page-1/#comment-66636
Tue, 17 Jul 2012 19:26:10 +0000http://sfdc.arrowpointe.com/?p=930#comment-66636[…] Email AutoComplete (using jQuery) @arrowpointe Q&A for using Email to Case Premium email application. […]
]]>By: Scott Hemmeterhttp://sfdc.arrowpointe.com/2011/11/18/email-autocomplete-using-jquery/comment-page-1/#comment-66129
Tue, 21 Feb 2012 22:17:27 +0000http://sfdc.arrowpointe.com/?p=930#comment-66129@teejay, the sidebar is the trick to getting the entire bit of code executed at all. If the sidebar is not executed, you can manually execute it in Firebug to make sure it works. Then its a matter of finding a place to put code so that it executes in the console. I’ve never really used the console so I am not sure where to put that.
]]>By: teejayhttp://sfdc.arrowpointe.com/2011/11/18/email-autocomplete-using-jquery/comment-page-1/#comment-66128
Tue, 21 Feb 2012 20:42:42 +0000http://sfdc.arrowpointe.com/?p=930#comment-66128I had already modified the code to work on some different fields, using firebug to find the id of the field. However when the email edit page is shown in the cloud console it seems to be wrapped in an iframe which prevents firebug from finding the id for the field. Also the javascript in the sidebar probably doesnt work in the cloud console as the url in the addressbar never seems to change. In fact with the cloud console I’m asking myself if the javascript in the sidebar still works at all, as there is no option to display the sidebar. …
]]>By: Scott Hemmeterhttp://sfdc.arrowpointe.com/2011/11/18/email-autocomplete-using-jquery/comment-page-1/#comment-66126
Tue, 21 Feb 2012 16:25:30 +0000http://sfdc.arrowpointe.com/?p=930#comment-66126@teejay, there are a few hardcoded areas in the code. You’ll need to look into the equivalents in the console. In the sidebar code, it has an IF statement checking on the URL so it only runs on the right pages. You’d need to include the URL of the console into that mix. In the main JavaScript, you’ll need to do more elems.push statements to include the IDs of the fields you want auto-complete on so that code actually applies autoComplete to those.

The solution I did is pretty hardcoded to the current pages and needs to be modified if Salesforce changes the UI or you want it on new pages.

]]>By: teejayhttp://sfdc.arrowpointe.com/2011/11/18/email-autocomplete-using-jquery/comment-page-1/#comment-66125
Tue, 21 Feb 2012 15:58:12 +0000http://sfdc.arrowpointe.com/?p=930#comment-66125This is great stuff! I got this working on my org, however it won’t work when using the new customer service console! Any ideas how to get it working?
]]>