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 Apex Trigger – Parent to Child Trigger Using List

    Salesforce Apex Trigger - Parent to Child Trigger Using List

    Blog in Others, Salesforce Apex

    Hello guys, In this blog, I am sharing the code of trigger it will update the contact field on updation or insertion of Account field.…

    Contact Fields, Parent Child Relationship, Parent Object, Parent Trigger, Salesforce Accounts
    Avnish Yadav Sep 24, 2018
    13,956  Views

    Guide to Salesforce Service Cloud Implementation

    Blog in Salesforce Cloud Platform

    In today’s fast-paced digital world, exceptional customer service can be the defining factor that sets businesses apart. Salesforce Service Cloud implementation offers a powerful solution…

    Dean Sep 5, 2025
    472  Views

    Drive Omnichannel Customer Experiences with Salesforce Interaction Studio

    Blog in Salesforce Products

    Discover how leading brands leverage the power of Marketing Cloud Interaction Studio to drive real-time customer experiences — fostering valuable brand engagement at the right…

    Chrome Extensions, Customer Experience, Salesforce, Salesforce Campaigns, Salesforce Cloud Platform
    DemandBlue Feb 21, 2019
    5,303  Views

    Popular Salesforce Videos

    How To Drive More Sales With Marketing Automation in 2023 | Marketing Cloud | Webinar

    How To Drive More Sales With Marketing Automation in 2023 | Marketing Cloud | Webinar

    Video in Salesforce Automation

    Are you curious about how to drive more sales for your business? Every business wants to create a market space for its business or product.…

    Salesforce Training, Salesforce Tutorial, salesforce, Marketing Automation, Salesforce Marketing Cloud
    Cyntexa Jan 3, 2023
    1,373  Views
    Salesforce Tutorial | Salesforce Summer '20 Release

    Salesforce Tutorial | Salesforce Summer '20 Release

    Video in Salesforce Training

    It's time for another Salesforce release. In this video, we talk about all of the new features that the Summer '20 release will give us.…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Video, Salesforce Learning
    Stimulus Consulting Jul 24, 2020
    1,660  Views
    Salesforce Relationship Considerations

    Salesforce Relationship Considerations

    Video in Salesforce Stories

    In this video learn about the Important considerations while working with different types of Relationships in Salesforce such as Lookup Relationship, Master-Detail Relationship, Many-to-Many Relationship,…

    salesforce, CRM, Many to Many Relationship, Salesforce Relationships, Master Detail Relationship
    Nauman Apr 3, 2020
    2,132  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.