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
Mohammadasif SiddiquiMohammadasif Siddiqui 

Develop a simple account search page, The results must include the following columns: Account Name, Billing State/Province, Phone and Website.

User-added image
Best Answer chosen by Mohammadasif Siddiqui
Mohammadasif SiddiquiMohammadasif Siddiqui
<apex:page controller="theController">
   <apex:form >
      <apex:pageBlock id="block">
         <apex:pageBlockSection title="search">
             
                  Search :<apex:inputText id="searchText" value="{!searchText}"/>
                  <apex:commandButton value="Search!" action="{!doSearch}"  rerender="block" />
       
        </apex:pageBlockSection>
       
        <apex:pageBlockSection title="Results"  >
           <apex:pageBlockTable value="{!results}" var="l" >
              <apex:column value="{!l.name}"/>
               <apex:column value="{!l.BillingCity}"/>
              <apex:column value="{!l.Website}"/>
              <apex:column value="{!l.phone}"/>
           </apex:pageBlockTable>
        </apex:pageBlockSection>
      </apex:pageBlock>
   </apex:form>
</apex:page>
 
public class theController {
 
     public String searchText { get; set; }
    List<Account> results;
  
    public List<Account> getResults() {
        return results;
    }
 
    public void doSearch() {
       
        results = [SELECT Name, BillingCity, Phone, Website
              	FROM Account
              	WHERE Name LIKE :searchText+'%'];
    }
}