Blogger Blogs Developer


Custom Search on text box is an important feature to be added in many projects. Most of the developers requirement is to create custom search and searching perform when keyup.
So, today we are going to learn how to create an autocomplete field using input tag.
So, lets get started!
We’ll start with an example . I will show you how to create a custom search for Contact in your Org.
We will perform this with Jquery.
1. First , Create a VisualForce Page.

Create a input field , assign an ID, Name and a function name to load on keyup.
Create a div class to show the suggested result based on your search on basis of Id.
2. Have a look on jquery Functions.

NOTE: Don’t forget to use the Script Tag, as without this functionality will not work.
First establish a salesforce API Connection. $Api.Session_ID and GETSESSIONID() return the same value, an identifier for the current session in the current context.
Session contexts are based on the domain of the request. That is, the session context changes whenever you cross a hostname boundary, such as from to or
The function load XML Doc loads when you enter text in your text box (onKeyUp). Then this function calls OnSuccess function if its gets some related match to your input.

Window.onLoad function loads first time when the page loads and calls getObject Function.
This function helps to get ID based on the web browser.
Ns4 – netScape
W3c – All latest browser
IE4- Internet explorer.
Based on the explorer it returns the result.

OnSuccess Function display records with the help of DivFunction. DivFunction helps to get the value from the input box.

Similar Posts