Toggle Side Panel

  • Home
  • Articles
    • All Articles
    • Blogs
    • Videos
    • Infographics
  • Consultants
    • Salesforce Product Expertise
      • Top Salesforce ConsultantsTop Salesforce Consultants
      • Marketing Cloud ConsultantsMarketing Cloud Consultants
      • Service Cloud ConsultantsService Cloud Consultants
      • Experience Cloud ConsultantsExperience Cloud Consultants
      • Analytics Cloud ConsultantsAnalytics Cloud Consultants
    • Salesforce Industry Expertise
      • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
      • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
      • Health Cloud ConsultantsHealth Cloud Consultants
      • Commerce Cloud ConsultantsCommerce Cloud Consultants
      • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
    • Salesforce Experts by Location
      • USATop Salesforce Consultants in USA
      • IndiaTop Salesforce Consultants in India
      • AustraliaTop Salesforce Consultants in Australia
      • United KingdomTop Salesforce Consultants in UK
      • CanadaTop Salesforce Consultants in Canada
  • Webinars
  • Marketplace
  • Advertise With Us
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Home
    • Articles
      • All Articles
      • Blogs
      • Videos
      • Infographics
    • Consultants
      • Salesforce Product Expertise
        • Top Salesforce ConsultantsTop Salesforce Consultants
        • Marketing Cloud ConsultantsMarketing Cloud Consultants
        • Service Cloud ConsultantsService Cloud Consultants
        • Experience Cloud ConsultantsExperience Cloud Consultants
        • Analytics Cloud ConsultantsAnalytics Cloud Consultants
      • Salesforce Industry Expertise
        • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
        • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
        • Health Cloud ConsultantsHealth Cloud Consultants
        • Commerce Cloud ConsultantsCommerce Cloud Consultants
        • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
      • Salesforce Experts by Location
        • USATop Salesforce Consultants in USA
        • IndiaTop Salesforce Consultants in India
        • AustraliaTop Salesforce Consultants in Australia
        • United KingdomTop Salesforce Consultants in UK
        • CanadaTop Salesforce Consultants in Canada
    • Webinars
    • Marketplace
    • Advertise With Us
    • Contact Us
    • Discussions
    Close search

    Activity › Forums › Salesforce® Discussions › Implementing client side search using Javascript in salesforce

    Tagged: Account, Javascript in Salesforce, Salesforce Apex Controller, Salesforce Visualforce, Salesforce Visualforce Page, Search Box, SOQL, SOQL Query

    • Salesforce® Discussions

      Implementing client side search using Javascript in salesforce

      Posted by Kumar on January 4, 2017 at 1:51 PM

      Hi everyone,

      I am a beginner in using Javascript for my VF pages, I have a visualforce page which searches an account on the basis of account name from all the accounts displayed on the page (all the accounts are fetched using a SOQL query in the page controller).

      Right now I have implemented the search with an apex controller, which uses an SOQL query from the server side to fetch the account.

      How can I implement this by using Javascript on my page?

      Any suggestions or resources to study are appreciated.

      Thanks

      Shekhar Gadewar replied 9 years ago 2 Members · 3 Replies
      • Account
      • Javascript in Salesforce
      • Salesforce Apex Controller
      • Salesforce Visualforce
      • Salesforce Visualforce Page
      • Search Box
      • SOQL
      • SOQL Query
    • 3 Replies
    • Shekhar Gadewar

      Member
      January 4, 2017 at 2:23 PM

      Hi Kumar,

       

      Can u share ur current work so it will help other group members

       

      Regards,

      Shekhar

    • Kumar

      Member
      January 5, 2017 at 7:00 AM

      Here is my code:

      VF Page:

      <apex:page controller="CustomAccountController">

      <script>
      function search(){
      ApexMethod();
      }

      </script>

      <apex:form >
      <apex:actionFunction name="ApexMethod" action="{!searchAccounts}" reRender="accountTable"/>
      <apex:pageBlock >

      <apex:outputText >Account Name</apex:outputText>
      <apex:inputText value="{!name}" onkeyup="search();"/>
      <apex:pageBlockSection columns="3">

      <apex:pageBlockTable id="accountTable" value="{!accounts}" var="acc">
      <apex:column value="{!acc.Name}"/>
      <apex:column value="{!acc.Id}"/>
      <apex:column value="{!acc.AnnualRevenue}"/>
      </apex:pageBlockTable>

      </apex:pageBlockSection>

      </apex:pageBlock>

      </apex:form>

      </apex:page>

      Controller:

      public class CustomAccountController {

      public list<Account> accounts { get; set; }
      public String name { get; set; }

      public CustomAccountController(){
      accounts = new list<Account>();
      accounts = [Select Name,Id,AnnualRevenue From Account];
      }

      public pageReference searchAccounts(){

      string query = '';

      if(name != ''){

      query = 'Select Name,Id,AnnualRevenue From Account Where Name like \''+name+'%\'';
      accounts = database.query(query);
      }
      else{

      query = 'Select Name,Id,AnnualRevenue From Account';
      accounts = database.query(query);
      }

      return null;
      }
      }

      Note: I have not implemented pagination for this page.

      • This reply was modified 9 years ago by  Kumar.
    • Shekhar Gadewar

      Member
      January 5, 2017 at 9:10 AM

      Many thanks Kumar!!

       

    Log In to reply.

    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me

    application solution

    Popular Salesforce Blogs

    On-Call Data Scientist

    Meet Your On-Call Data Scientist Unit | Salesforce Developer Guide

    Blog in Others, Salesforce

    We should Figure Out Why Those Margins Are Shrinking. Envision that you are the VP of activities for a significant car provider. You're answerable for…

    CFO, Conceptualize Arrangements, Critical Issues, Dataset, Developing Chatter String
    MOHIT Apr 30, 2021
    2,515  Views

    Top 11 Extensions for Salesforce Developers

    Blog in Salesforce

    Extensions are computer programs that let users personalize their Chrome surfing experience. They are created using web technologies like HTML, CSS, and JavaScript. documentation for…

    Apex Triggers, API Names, API Versions, Autocomplete, Campaign Management
    SP Aug 30, 2023
    1,120  Views
    Salesforce data mask

    Salesforce Data Mask | Secure your Sandbox with Impenetrable Security

    Blog in Data, Salesforce Security

    Salesforce sandbox is where the developers spend most of their lifetime. With all the development and testing taking place here, Salesforce sandbox is always a…

    Business Process, California Consumer Privacy Act, CCPA, Data Exchanges, Data Mask
    DemandBlue May 11, 2020
    2,821  Views

    Popular Salesforce Videos

    Subscribe to Dashboards and Reports (Salesforce Lightning Experience)

    Subscribe to Dashboards and Reports (Salesforce Lightning Experience)

    Video in Lightning

    By subscribing to a dashboard or report, you can have it refreshed and waiting in your inbox before the weekly sales meeting, or whenever you…

    Salesforce Training, Salesforce Tutorial, Salesforce Lightning, Salesforce Lightning Experience, Salesforce Learning
    Prafull Jan 19, 2022
    2,899  Views
    Uncomplicating Sales with Salesforce CPQ

    Uncomplicating Sales with Salesforce CPQ

    Video in Salesforce Products, Sales

    Sales representatives spend 34 percent of their time doing actual sales, while a staggering 66 percent of their time generating quotations, ideas, and gaining approvals,…

    salesforce, CPQ, Salesforce Video, sales, Salesforce Learning
    Algoworks Sep 25, 2020
    1,648  Views
    Discount Categories in Salesforce CPQ

    Discount Categories in Salesforce CPQ

    Video in Salesforce Training

    Use the discount category object to store values that you want to apply via rules to one or more products. After you associate the discount…

    Salesforce Training, Salesforce CPQ, Salesforce Video, Salesforce Learning, Product Rule
    Rupal Kakkar Jun 14, 2021
    2,684  Views
    Footer Forcetalks logo

    support@forcetalks.com

    • twitterx

    Quick Links

    Advertise with Us

    Salesforce® Articles

    Dreamforce 2023

    Top Salesforce® Bloggers 2023

    Top Salesforce Consultants

    Get Listed

    Company

    Contact Us

    About Us

    Privacy Policy

    Terms & Conditions

    InsightHub

    Salesforce Blogs

    Salesforce Videos

    Salesforce Groups

    Salesforce Jobs

    © 2026 - Forcetalks ● All Rights Reserved

    Salesforce® is a trademark of Salesforce® Inc. No claim is made to the exclusive right to use “Salesforce”. Any services offered within the Forcetalks website/app are not sponsored or endorsed by Salesforce®.

    Try AuditMyCRM - It is a Salesforce CRM Audit tool which comprehensively scans your Salesforce org and gives you the list of errors or warnings you need to take care of.
    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.