Toggle Side Panel

  • Blogs
  • 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
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Blogs
    • 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
    • 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, 9 months 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

    • [adinserter block='9']
    • 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, 9 months 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

    Popular Salesforce Blogs

    Learn All About Salesforce Managed Services vs In-house Team

    Blog in Salesforce Consultant

    The day-to-day operations of modern businesses depend on technology and cloud-based tools. With ever-changing IT needs and business configuration tools becoming more important, one small…

    Benefits of Salesforce, Business Analysts, Business Configuration Tools, Cloud-based Tools, Configurations
    AblyPro Oct 7, 2021
    4,588  Views

    Salesforce Essentials For Small Business

    Blog in Salesforce

    Salesforce Essentials was launched by Salesforce two years ago. This product is purpose-built for small companies to get access to a ready CRM package for…

    AppExchange, Automate Repetitive Tasks, Business Needs, Cases, Contacts
    Apphienz Apr 7, 2021
    2,149  Views

    Understanding Salesforce: Empowering Businesses with Cutting-Edge CRM Solutions

    Blog in Salesforce

    In the rapidly evolving landscape of modern business, customer relationships are paramount. Maintaining seamless interactions, personalized experiences, and efficient processes are essential to success. This…

    Beacon of Innovation, Benefits, Business Management, Cloud-based, Commerce Cloud
    Mukilan Aug 29, 2023
    1,987  Views

    Popular Salesforce Videos

    Export Data from Salesforce using Data Loader - Step by Step Process

    Export Data from Salesforce using Data Loader - Step by Step Process

    Video in Data, Salesforce Training

    In this video learn how to Export Data from Salesforce to CSV using Data Loader. You can install Data Loader on Windows or Mac. And…

    Salesforce Data Management, Salesforce Data Migration, Salesforce Data Loader, Data Management In Salesforce, Salesforce Data Types
    Jogender Feb 9, 2018
    2,467  Views
    Salesforce CPQ: Fixing Percent of Total Calculations for Amended Quotes

    Salesforce CPQ: Fixing Percent of Total Calculations for Amended Quotes

    Video in Salesforce Products

    Salesforce users looking to enhance their product-quoting processes can take advantage of Salesforce Configure, Price, Quote Software, or CPQ. Some features require the use of…

    Salesforce Training, salesforce, Salesforce CPQ, CPQ, Salesforce Video
    DB Apr 7, 2022
    2,743  Views
    Are they secure enough ? Web to Lead Forms | Validations | SPAM | CAPTCHA | Salesforce Tutorials

    Are they secure enough ? Web to Lead Forms | Validations | SPAM | CAPTCHA | Salesforce Tutorials

    Video in Salesforce Admin

    Are you using web to lead forms ? Do you think it's secure enough ? In this video you will get all your answers. And…

    salesforce, Salesforce Tutorials, Salesforce Admins, Salesforce Video, Salesforce Learning
    Kapil May 11, 2020
    2,122  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®.

    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.