Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6733919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:49:39+00:00 2026-05-26T10:49:39+00:00

I want to use a apex:selectList to populate contacts. The problem is that it

  • 0

I want to use a apex:selectList to populate contacts. The problem is that it gives an error

  Collection size 3,403 exceeds maximum size of 1,000

This is because i have 3403 contacts, and Vf has limitation on the collections in the VF page.

I want to limit the inital set of contacts to <1000, and as the user starts typing in the characters i would want to query the contacts. For ex if the user types in Ji i want to query the contacts to retrieve records starting with JI.

Is this possible to do?

  <apex:selectlist id="ClientsSearch"  value="{!Appointment.Client__c}" 
       size="1" required="true" rendered="{!NOT (SearchMode)}">

  <apex:selectOptions value="{!Clients}" />
  </apex:selectlist>


 public List<SelectOption> getClients() {     
   List<SelectOption> options = new List<SelectOption>();
  List<Contact> Clients =  [Select id, Name From Contact order by Name];
  options.add(new SelectOption('0001', '--Select--'));
 for(Contact c : Clients ){
 options.add(new  SelectOption(c.id, c.Name));
 }
  return options;
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:49:40+00:00Added an answer on May 26, 2026 at 10:49 am

    You can use wild cards in your query to do this — so you’ll want to add an <apex:inputText> element in your page to allow them to enter a search term, which writes to a string variable in the controller. Then add a search button to run the query and re-render the list with the new list of contacts.

    The important parts of the controller will look something like this:

    public string SearchTerm {get; set;}
    public list<ContacT> Contacts {get; set;}
    
    public Pagereference SearchContacts()
    {
        // etc.
        Contacts = [select Id, Name from Contact where name like : '%' + SearchTerm + '%' order by name limit 1000]; 
        // populate list here
        return null;
    }
    

    You could perform the search using an action function and firing it from the onChange event of the input field but having a button to do the search will make the whole thing more response (IMO) from the user’s point of view.

    Note: I wrote this code on the fly, it may be that you can’t just concat ‘%’ with the search term in this manner or maybe that you don’t even need to when querying directly. Usually in these cases I’ve had to utilise dynamic SOQL due to other requirements, where you build up the query in a string:

    strQuery = 'select id from contact where name like \'%' +
        String.escapeSingleQuotes(SearchTerm) + '%\' order by name';
    for(Contact sContact : Database.query(strQuery) ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want use from multiple upload image in codeigniter but problem is here that
I want use a typedef struct that isn't already defined, but it is later.
I want use page that has this form: <form method=post action=modules.php?name=search> <input onkeypress=FKeyPress(this); onkeydown=FKeyDown(this);
I want use Kendo ui window, but I can't see what the problem is.
i want use single quotations inside a transact sql statement, then execute that statement.
So I want use multiple div tags that use webkit borders but for some
I want use variables from inherits in asp code My code looks like that
I have a simple function that uses a callback and I want use functor
I want use Twisted in Python, but when I installing ,in comes this error,
I want use regex to find something in string (or QString) that is between

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.