function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Raju Sudheer 3Raju Sudheer 3 

how to implement autolookup and query from vf page

NagaNaga (Salesforce Developers) 
Hi Raju,

The purpose of the component is to enable autocomplete in lookup fields. I used the autocomplete js created by Jim Roos:
(http://www.jimroos.com/2007/05/ajax-autocomplete.html) but made some modifications to it so that it could interact with an Apex controller among some other things...

So my idea was that if you were making a VF page that had an inputfield that was related to a lookupfield you would just insert this autocomplete component to that inputfield. Something like this:

Code:1 <apex:inputField value="{!Contact.accountid}" id="accname" styleClass="cField"><br>            <c:autocomplete ObjectName="Accounts" InputId="{!$Component.accname}" AutoCompleteId="accACid"ClassName="autocomplete300"/><br>           </apex:inputField>
The component has 4 parameters:

The name of the object or custom object that the inputfield relates to (new objects must be added inside the apex classes since i had some problems constructing a dynamic query).
The InputId which is used to relate the component to the input field
The id for the Component
A classname parameter that basically just defines the width of the suggestions menu.

Please see the below link

https://developer.salesforce.com/forums/?id=906F000000094e7IAA

Best Regards
Naga Kiran