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

    Manufacturing in Salesforce

    Integrating Production Runs and Supply Chain for Manufacturing in Salesforce

    Blog in Salesforce

    Although there are different kinds of businesses and all of them varied from each other, one thing that’s a common issue is the lineal supply…

    Boost Business, Businesses, Case Management, Collaboration with Suppliers, Communication
    360 Degree Dec 20, 2021
    2,607  Views

    WordPress and Salesforce Integration - What You Should Know

    Blog in Salesforce integration

    Organizations that want to improve the way they deliver digital assets to their audiences would benefit from using WordPress together with Salesforce. When you deliver…

    Bi-directional Syncing, Build Forms, Capturing Data, Constant Contact, Contact Forms on Websites
    Apphienz Jul 20, 2021
    2,325  Views
    salesforce url hacking

    Salesforce URL Hacking Button for Lightning Experience

    Blog in Lightning, Salesforce

    The Salesforce Lightning URL Hack is a strategy for making an extraordinary hyperlink or content and uncovering it by means of catch or recipe field.…

    API Field Name, Business Account Page Layout, Classic URL Hacks, Custom Action, Custom Actions
    Pooja May 7, 2020
    12,553  Views

    Popular Salesforce Videos

    Get Started with Salesforce Functions

    Get Started with Salesforce Functions

    Video in Salesforce Stories

    This session will introduce you to Functions, discuss common use cases and help developers get started with local development and any scratch org. If you…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Video, Salesforce Functions
    Prafull Nov 16, 2021
    1,579  Views
    Data Migration - Salesforce Admin Tutorial

    Data Migration - Salesforce Admin Tutorial

    Video in Data

    In this video, Zorial Salesforce Tech gives a quick k overview of how to migrate data using Salesforce. He goes over some key points to…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Data, Salesforce Admin
    Rahul kapoor Nov 7, 2022
    1,455  Views
    Get the Most Out of Your Digital Adoption Efforts On Your Salesforce Community with GuideIn

    Get the Most Out of Your Digital Adoption Efforts On Your Salesforce Community with GuideIn

    Video in Salesforce Communities

    Navigating online communities can be tricky. GuideIn is a Salesforce-native, lightning-ready product from the house of Grazitti that enables you to maximize digital adoption in…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Community, Salesforce Learning
    Grazitti Jul 18, 2022
    2,354  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.