function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MarissaMMarissaM 

Visualforce - show text field based on picklist

Hey all - I've researched enough to understand that what I need to do can only be done in Visualforce: displaying a text field based on picklist options.

Basically, I have 5 fields "RP 1, RP 2, RP 3, RP 4, RP 5" in a custom object "Staff Development" and they all are picklists that have the same options for answers (the 34 clifton strengths - basically I am trying to give everyone a place to identify their top 5 strenghts on a page).

Based on the answers in ALL 5 of these fields collectively, I want to display further information. So if the answers in the picklists include (order doesn't matter) Adaptability, individluzation, woo, empathy, and developer - then there needs to be 5 text fields (with default values) named Adaptability, Individualization, Woo, Empathy, and Developer that pop up that shows the description for each of those answers.

Again, doesn't matter which of the 5 "RP" fields is chosen that includes one of those strengths, if the picklist choice is chosen in any of the 5 picklist fields, that text field appears (normally hidden) and displays the information. 

Any help appreciated!
Ankush AgarwalAnkush Agarwal
Hi,

You may try for below solution:

<apex:inputField id="Id1" value="{!Obj.Field1}" rendered="{!IF(PicklistValue = 'Adaptability')}"/>
<apex:inputField id="Id2" value="{!Obj.Field2}" rendered="{!IF(PicklistValue = 'individluzation')}"/>
<apex:inputField id="Id3" value="{!Obj.Field3}" rendered="{!IF(PicklistValue = 'woo')}"/>
<apex:inputField id="Id4" value="{!Obj.Field4}" rendered="{!IF(PicklistValue = 'empathy')}"/>
<apex:inputField id="Id5" value="{!Obj.Field5}" rendered="{!IF(PicklistValue = 'developer')}"/>