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
RadDude89RadDude89 

Field appearing based on criteria

Hi,

Is it possible to show a field on a visualforce page based on previous selection?

For example: if the value in field 1 was true then show field 2 in the vf page else it doesn't appear.

Best Answer chosen by RadDude89
Bhawani SharmaBhawani Sharma
<apex:inputField value="{!Account.Type}" >
    <apex:actionSupport event="onChange" reRender="opField2">
</apex:inputField>

<apex:outputPanel id="opField2">
    <apex:inputField value="{!Account.Name}" rendered="{!(Account.Type = 'Some Value')}" />
</apex:output:Panel>

All Answers

Bhawani SharmaBhawani Sharma
<apex:inputField value="{!Account.Type}" >
    <apex:actionSupport event="onChange" reRender="opField2">
</apex:inputField>

<apex:outputPanel id="opField2">
    <apex:inputField value="{!Account.Name}" rendered="{!(Account.Type = 'Some Value')}" />
</apex:output:Panel>

This was selected as the best answer
Bhawani SharmaBhawani Sharma
Did it help?
RadDude89RadDude89

Hi Bhawani,

Yeah it did, thanks for the reply

Bhawani SharmaBhawani Sharma
Great. Can you please mark the question resolved?