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.
1 Answer
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>
-
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" Jan 5, 2016 at 16:18 -
1