You need to sign in to do that
Don't have an account?
sam sj
Unable to restrict number of values for custom autocomplete feature built for a field in visualforce page
Hi,
I have a visualforce page where in a particular field I am using salesforce list attribute to display the fetched records from database via autocomplete. As per the autocomplete feature it's showing all the related records as per the user's search. Is there a way to limit number of records seen in autocomplete as it looks odd to display all records. I want to restrict it to show 10 names in autocomplete. Code im using is
<apex:input label="office" value="{! selectedAccount }" list="{! Accounts}" id="txt" />
In apex controller im using a getter to fetch records through query and its been used by list attribute .
I have a visualforce page where in a particular field I am using salesforce list attribute to display the fetched records from database via autocomplete. As per the autocomplete feature it's showing all the related records as per the user's search. Is there a way to limit number of records seen in autocomplete as it looks odd to display all records. I want to restrict it to show 10 names in autocomplete. Code im using is
<apex:input label="office" value="{! selectedAccount }" list="{! Accounts}" id="txt" />
In apex controller im using a getter to fetch records through query and its been used by list attribute .
bob_buzzard
You should be able to add a 'limit 10' clause to the SOQL query to achieve this, assuming you don't want to send all records across and only display 10 of them.
sam sj
HI bob, what I m actually doing is getting all list of records of an object using soql when constructor is loaded and using autocomplete feature where control is back and forth between visualforce page and controller. I m not querying at the backend for each letter the user types in the field