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 › How can show input text as pick-list depends on the another pick-list value in salesforce?

    Tagged: Account, Picklist, Salesforce Custom Field, Salesforce Development, Salesforce Visualforce, Salesforce Visualforce Page, Text Field

    • Salesforce® Discussions

      How can show input text as pick-list depends on the another pick-list value in salesforce?

      Posted by NAVEEN on January 18, 2017 at 9:54 AM

      I have one pick-list fields with Account fields and one Input Text field on Vf page, My requirement is when i select industry in pick list then Input Text field has to shown pick list values of Industry? how can I achieve this?

      Kumar replied 9 years ago 2 Members · 1 Reply
      • Account
      • Picklist
      • Salesforce Custom Field
      • Salesforce Development
      • Salesforce Visualforce
      • Salesforce Visualforce Page
      • Text Field
    • 1 Reply
    • Kumar

      Member
      January 23, 2017 at 7:37 AM

      Hi Naveen,

      Here is an example with countries and states. First, define your Visulforce Page with the picklists.
      You can see that it uses a custom controller and an event "onchange" on country list to change the content of the states list when you select a country.

      Here is the code:

      <apex:page controller="ctlDepPickLst">
      <apex:form >
      <apex:pageBlock>
      <apex:pageBlockSection columns="2">
      <apex:pageblockSectionItem>
      <apex:outputLabel value="Country"/>
      </apex:pageblockSectionItem>
      <apex:pageblockSectionItem>
      <apex:selectList size="1" value="{!country}">
      <apex:selectOptions value="{!countries}"/>
      <apex:actionSupport event="onchange" reRender="a"/>
      </apex:selectList>
      </apex:pageblockSectionItem>
      <apex:pageblockSectionItem>
      <apex:outputLabel value="State"/>
      </apex:pageblockSectionItem>
      <apex:pageblockSectionItem>
      <apex:selectList size="1" value="{!state}" id="a">
      <apex:selectOptions value="{!states}"/>
      </apex:selectList>
      </apex:pageblockSectionItem>
      </apex:pageBlockSection>
      </apex:pageBlock>
      </apex:form>
      </apex:page>

      Here is the custom controller:

      public class ctlDepPickLst {
      public String country {get;set;}
      public String state {get;set;}

      public List<SelectOption> getCountries()
      {
      List<SelectOption> options = new List<SelectOption>();
      options.add(new SelectOption('None','--- Select ---'));
      options.add(new SelectOption('US','United States'));
      options.add(new SelectOption('IN','India'));
      return options;
      }

      public List<SelectOption> getStates()
      {
      List<SelectOption> options = new List<SelectOption>();
      if(country == 'US')
      {
      options.add(new SelectOption('CO','Colorado'));
      options.add(new SelectOption('NE','Nevada'));
      options.add(new SelectOption('TE','Texas'));
      }
      else if(country == 'IN')
      {
      options.add(new SelectOption('BI','Bihar'));
      options.add(new SelectOption('KE','Kerala'));
      options.add(new SelectOption('MA','Manipur'));
      }
      else
      {
      options.add(new SelectOption('None','--- Select ---'));
      }
      return options;
      }
      }

      Hope this helps.

      • This reply was modified 9 years ago by  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

    Why Should I Move My Business to Salesforce

    Blog in Salesforce Consultant

    If you are exploring the realm of the CRM business, you will run into plenty of CRMs, with a considerable lot of them offering the…

    Cloud Based CRM, Features of Salesforce, Programming Model, Salesforce Businesses, Salesforce Consultant
    William Apr 26, 2019
    3,616  Views
    How To Get Salesforce Mobile App Development Services With Low Coding?

    How To Get Salesforce Mobile App Development Services With Low Coding?

    Blog in Salesforce Implementation

    Salesforce has given a new platform especially for those who do not have any interest in coding or who do not want to code. Focus…

    Salesforce Mobile App Development
    Louis Aug 25, 2017
    5,282  Views
    salesforce artificial intelligence

    Artificial Intelligence in Salesforce Einstein - An Overview

    Blog in AI and ML, Salesforce

    To begin with artificial intelligence, it is the branch of computer science that focuses on the development of machine intelligence which makes machines work like…

    Artificial Intelligence, Computer Science, Customer Satisfaction, Data Sets, Financial Analysis
    Anjali Jun 26, 2020
    6,397  Views

    Popular Salesforce Videos

    Salesforce Developer Training Videos For Beginners | Salesforce Training Videos | Edureka

    Salesforce Developer Training Videos For Beginners | Salesforce Training Videos | Edureka

    Video in Salesforce Training

    This Salesforce developer training video will give you an introduction to the development aspects of Salesforce. You will learn how Visualforce pages are created by…

    Salesforce Training, Salesforce Development, Salesforce Apex, salesforce, Apex
    Rupal Kakkar Mar 26, 2020
    2,745  Views
    Salesforce Marketing Cloud - Introduction

    Salesforce Marketing Cloud - Introduction

    Video in Marketing, Salesforce Cloud Platform

    Watch this video and learn about Salesforce Marketing Cloud. This is an introduction video. If you have any questions or doubts, please let us know…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Marketing Cloud, Salesforce Video
    Nauman Jan 4, 2022
    1,677  Views
    Heroku | Salesforce Development Course

    Heroku | Salesforce Development Course

    Video in Salesforce Certifications, Salesforce Training

    Knowledge of Heroku is also required to crack the Salesforce PD 1 Certification Examination. Let’s understand what Heroku is and what are its uses, in…

    Salesforce Training, Salesforce Certification, Salesforce Video, Salesforce Learning, Heroku
    S2 Apr 8, 2022
    1,688  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.