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, 7 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, 7 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

    Maximizing Business Potential with Salesforce Managed Services

    Blog in Salesforce

    Introduction In today's competitive business landscape, organizations need robust tools and platforms to streamline their operations, improve customer engagement, and drive growth. Salesforce, as a…

    Automation, Business Growth, Competitive Advantage, Continuous Improvement, CRM solution
    TRooTech Mar 21, 2024
    1,051  Views
    Change Set

    Deploying Workflows Through Change Set | The Salesforce Developer Guide

    Blog in Others

    Salesforce Workflow Rules are the automated processes used in business processes to send Email alerts, assign a task, update a field on rule criteria or…

    Automated Processes, Bundle Dynamic Streams, Business Processes, Change Set, Changeset Components Section
    Ratnesh Dec 31, 2020
    13,780  Views

    Salesforce declares a new Content Management System

    Blog in Salesforce Releases

    Salesforce announced a new tool named Salesforce Content Management System recently which is designed in an optimized manner to deliver a quality customer experience across multiple channels. The…

    CMS, CRM Record, Digital Platforms, Salesforce Content Management System, Salesforce Developers
    AwsQuality Nov 21, 2019
    2,991  Views

    Popular Salesforce Videos

    Increase ROI by Investing in People | Make Earth Your Business

    Increase ROI by Investing in People | Make Earth Your Business

    Video in

    The video discusses the benefits of businesses that invest in and believe in their employees, customers, and communities. Investing in employee training and upskilling programs…

    salesforce, Customers, Employees, Productivity, Businesses
    Jogender Apr 18, 2023
    1,094  Views
    How Admins Can Improve Salesforce Data Quality

    How Admins Can Improve Salesforce Data Quality

    Video in Data, Salesforce Training

    Learn how to diagnose the accuracy of your data and build a plan to maintain and enhance its’ quality using Salesforce tools. Follow along to…

    Salesforce Training, Salesforce Tutorial, Salesforce Tools, Data Quality, Admins
    Prafull Jun 10, 2022
    2,338  Views
    Manage Record Access and Visibility in Salesforce

    Manage Record Access and Visibility in Salesforce

    Video in Salesforce Training

    Watch this video to learn all about managing record access and visibility in Salesforce. Do let us know in the comment section if you have…

    Salesforce Training, Salesforce Tutorial, Salesforce Records, Salesforce Video, Salesforce Learning
    Pooja Nov 18, 2021
    2,120  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.