+ Start a Discussion

Turning Standard Fields into Lookups with Autocomplete??

Hi Guys,

Just trying to see if this can be done using some standard SF VF stuff or a hack combination of some of the new features.

On a Visual force page I'd like to make a <apex:inputField> which is just a text field a lookup to any object I want.

A use case for this is. A input form made in VF where someone would enter a name into an apex input field for e.g

<apex:inputField Value="{!CustomObject.Name__c}" />

but that field is just a text field. When someone starts typing it will do the kinda cool but kinda limited lame 'sf lookup autocomplete' for contacts in 'recent items (would help if this was every record!! /rant)... If someone see's that their contact is not in their 'autocomplete' list then they just type a name and click enter. This will populate "Contact.Name__c" with whatever they typed.

If they select an option from the autocomplete list then Name__c will populate with the name of the Contact found.
So really it's just an autocomplete type function from scratch. I tried implementing the old Salesforce Labs Autocomplete on Lookups S-Control (Which is GREAT because it looks up every record on an object /rant)

But unfortunately it doesn't work on VF pages :(

Any help with some sort of lookup would be great. Trying to implement 3rd Party javascript autocomplete's has turned out to be such a nightmare with salesforce formatting and VF pages.

So again Thanks in advance and any help would be greatly appreciated.

Message Edited by patske on 07-01-2008 11:59 PM