You need to sign in to do that
Don't have an account?
DrawloopSupport
Using rendered="false" on an apex:selectOption element does not hide the option
Using the following visualforce markup, the second select option, which should not be displayed, is shown.
<apex:page> <apex:form> <apex:selectList size="1"> <apex:selectOption itemLabel="test" itemValue="test" /> <apex:selectOption itemLabel="don't show" itemValue="bad" rendered="false" /> </apex:selectList> </apex:form> </apex:page>
Any ideas?
The documentation looks like it should work.
https://na4.salesforce.com/apexpages/apexcomponents.apexp
apex:selectOption
Attribute name: rendered
Attribute type: boolean
Description: A Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true.
Api Version: 10.0
Can anyone at Salesforce shed some light on this? Is it a bug?
TehNrd,
I did not open a case. I must have worked around the issue as I cannot remember why I needed it. Please let me know if you get it resolved through Salesforce.
Thanks!
YES! This has been fixed in Spring 10! Now it is a little easier to do dependent picklists. Still have to hardcode, but at least no apex is required.
<apex:page standardController="Opportunity"> <apex:form > <apex:selectList size="1" value="{!Opportunity.Name}"> <apex:selectOption itemLabel="--None--" itemValue="none" /> <apex:selectOption itemLabel="even" itemValue="even" /> <apex:selectOption itemLabel="odd" itemValue="odd" /> <apex:actionSupport event="onchange" reRender="dependent"/> </apex:selectList><br/><br/> <apex:selectList size="1" id="dependent"> <apex:selectOption itemLabel="1" itemValue="1" rendered="{!Opportunity.Name == 'odd'}"/> <apex:selectOption itemLabel="2" itemValue="2" rendered="{!Opportunity.Name == 'even'}"/> <apex:selectOption itemLabel="3" itemValue="3" rendered="{!Opportunity.Name == 'odd'}"/> <apex:selectOption itemLabel="4" itemValue="4" rendered="{!Opportunity.Name == 'even'}"/> </apex:selectList> </apex:form> </apex:page>