+ Start a Discussion
SFDC New learnerSFDC New learner 

Need help with autosuggest in the input text field

Hi All,

I have a user object with a username field. When I try to enter a letter, it should show all the values that start with that letter.

Say, for example, If I enter a letter J, it should display all the names that start with J like John, Jeff and so on.

How to implement this functionality using vf page?

Khan AnasKhan Anas (Salesforce Developers) 
Hi Sirisha,

Greetings to you!

Below is the sample code which I have tested in my org and it is working fine. Kindly modify the code as per your requirement.

<apex:page Controller="AutoSuggestC" docType="html-5.0">
            Enter Account Name : <apex:inputText list="{!listOfStrings}"/>

public class AutoSuggestC {
    public List<String> listOfStrings {get; set;}
    public AutoSuggestC() {
        listOfStrings = new List<String>();
        for(Account a: [SELECT id, Name From Account LIMIT 10])

This feature works only when the docType of VF page is set to “html-5.0”.

Please refer to the below links which might help you further with the above requirement.





I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas