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

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

    application solution

    Popular Salesforce Blogs

    Salesforce IoT Cloud Consulting Services: Enhancing Customer Experience

    Blog in Others

    The way businesses engage with consumers, devices, and data has been changed by the Internet of Things (IoT). With the ability to communicate with consumers…

    app development, Best Customer Experiences, Big Data, Business Analytics Software, Business Executives
    Emorphis Mar 13, 2023
    2,825  Views
    record triggered flows

    What are Record-triggered Flows in Salesforce? | The Ultimate Guide

    Blog in Salesforce

    One of Salesforce's most potent features is Record-Triggered Flows (RTFs). You may automate procedures and lessen human labor by using RTFs to design flows that…

    Auto Launched Flow, Automate Procedures, Automatically triggered, Before-Save, Best Practices
    Mayank May 2, 2023
    2,293  Views

    Reasons To Choose Salesforce CRM for Agribusiness | Salesforce 101

    Blog in Salesforce

    Agribusinesses are increasingly turning to Salesforce CRM (Customer Relationship Management) to help them streamline their operations, connect with customers and increase profits. As the world’s…

    Benefits of Salesforce, Business, Business Brand Value, Business Channels, Business Market
    Emorphis Feb 17, 2023
    1,707  Views

    Popular Salesforce Videos

    Lead Process in Salesforce | How To Manage Leads in Salesforce Sales Cloud?

    Lead Process in Salesforce | How To Manage Leads in Salesforce Sales Cloud?

    Video in Salesforce Consultant

    Leads are potential customers who have expressed interest in your product or service but haven't made a purchase yet. They're like the starting point of…

    Salesforce Tutorial, salesforce, Salesforce Video, Salesforce Lead Objects, Sales Cloud
    ENWAY Jul 4, 2024
    573  Views
    Reaching Potential Customers With Salesforce Marketing Cloud

    Reaching Potential Customers With Salesforce Marketing Cloud

    Video in Marketing, Salesforce Cloud Platform

    Salesforce Marketing Cloud helps businesses in closely observing consumer behavior. Marketing Cloud has a number of platforms that are well-segregated and immensely useful in defining…

    salesforce, Salesforce Marketing Cloud, Salesforce Video, Salesforce Learning, Marketing
    Algoworks Nov 27, 2020
    1,337  Views
    Manual & Apex Managed Sharing in Salesforce

    Manual & Apex Managed Sharing in Salesforce

    Video in Salesforce Apps

    In this video, we will talk about Manual Sharing and Apex Managed Sharing. Manual Sharing Manual Sharing is used to share the record Manually. For…

    Salesforce Training, salesforce, Salesforce Video, Salesforce Learning, sharing rules
    Jogender Dec 31, 2020
    2,892  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.