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 8 years, 10 months 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 8 years, 10 months 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

    Salesforce Wave

    Salesforce Wave: The New Salesforce Analytics Platform

    Blog in Analytics, Salesforce

    For those who missed the Dreamforce keynotes or the highlights of the marketing and promotional campaigns by Salesforce teams, here is a quick one-line summary…

    CRM Product, Dashboard Customizations, Dreamforce, Mobile First Platform, NoSQL
    Algoworks Oct 27, 2017
    5,560  Views
    Customize Salesforce Login Page

    How to Customize Salesforce Login Page

    Blog in Salesforce Training, Salesforce Tutorial

    Introduction Here we are going to learn about how to customize the domain name and login page. We will also understand how to change our…

    Change Logo, Custom Domain, Custom or Standard Logo, Deploy New Domain, Domain Name
    Rajat Shende Jun 15, 2021
    14,683  Views

    Salesforce Integration Architecture: Patterns and Best Practices

    Blog in Others

    Salesforce, while powerful on its own, often thrives when connected to other systems. This integration allows for seamless data flow, streamlined processes, and a unified…

    Cloudy Aug 1, 2025
    254  Views

    Popular Salesforce Videos

    Salesforce Marketing Cloud Connect Complete Setup in Lightning

    Salesforce Marketing Cloud Connect Complete Setup in Lightning

    Video in Marketing, Salesforce Cloud Platform, Salesforce Training

    Cameron Robert demonstrates a complete end-to-end setup of Marketing Cloud Connect in Lightning view. Marketing Cloud Connect creates an integration between Salesforce CRM and Salesforce…

    Salesforce Training, Salesforce Tutorial, Salesforce Integration, Process Automation, salesforce
    Cameron Jul 28, 2022
    2,814  Views
    Benefits of Having Veteran In an Organization | Career in Salesforce

    Benefits of Having Veteran In an Organization | Career in Salesforce

    Video in Salesforce Training

    Let's Understand how a veteran can start their career in Salesforce? In this Episode Davis and Shrey covered the following questions: 1. About his background and…

    Salesforce Training, Salesforce Jobs, Salesforce Certification, Trailhead, Salesforce Hulk
    S2 Nov 17, 2021
    1,621  Views
    Reassign Leads using Lead Assignment Rule on Update/Upsert | Salesforce Tutorials | #SalesforceBolt

    Reassign Leads using Lead Assignment Rule on Update/Upsert | Salesforce Tutorials | #SalesforceBolt

    Video in Salesforce Development

    In this vlog, we will do some work around Assignment Rules. As you are aware Assignment Rule can be trigger on Insert actions. Either it…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Video, Salesforce Learning
    Kapil Jun 10, 2020
    2,986  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

    © 2025 - 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.