1

We have a visual force page which contain a picklist with values 'yes' and 'no' and there is another section which contain a number of fields. So what is required is that on yes ,the section appears and on 'no' the section is hidden.

7

You can achieve this using actionSupport that triggers on the change of the picklist and rerenders the output panel. The ouput panel only shows if the picklist value is not null and is equals to "yes" (formula required). Here is a simple example of how you can implement this:

<apex:inputField value="{!object.MyPickList__c}">
    <apex:actionSupport event="onchange"
                        rerender="MyPanel"/>
</apex:inputField>

<apex:outputPanel id="MyPanel">
    <apex:outputPanel rendered="{!IF(NOT(ISBLANK(object.MyPickList__c)) && 
                                     ISPICKVAL(object.MyPickList__c, 'yes'),true,false)}">
        ...
    </apex:outputPanel>
</apex:outputPanel>
2
  • does ` ISPICKVAL(object.MyPickList__c, 'yes'),true,false)}">` work? I have ISPICKVAL(Request_for_System_Change__c.Request_Priority__c, 'High') and get an error: "Save error: Incorrect parameter type for function 'ISPICKVAL()'. Expected Picklist, received Text" – Our Man in Bananas Jan 5 '16 at 16:18
  • 1
    Brilliant solution. thanks a lot! – Yonathan Goriachnick Nov 13 '19 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.