You need to sign in to do that
Don't have an account?
how to hide selectList based on condition
Hi All,
Can any one tell me how to hide selectList based on condition if countries contain list value then show pickList else hide, below is my code:
VisualForce Code:
<apex:outputText id="subTrip" rendered="{!countries.size >= 0}" >
<apex:selectList id="list" value="{!country}" size="1">
<apex:selectOptions value="{!countries}" />
</apex:selectList>
</apex:outputText>
Controller Code:
public String country {get;set;}
public List<SelectOption> getCountries() {
List<SelectOption> optetions = new List<SelectOption>();
List<Country__c> items = [select Name,Id from Country__c where Id =:selectedId ];
for(Country__c c : items){
options.add(new SelectOption(c.Id,c.Name));
}
Thanks in Advance,
Regards,
Sandy
You have pretty much everything right, except rendered="{!countries.size >= 0}. It should be rendered="{!countries.size >0}.
Did I answer your question? If yes please mark this as the solution. Thanks.
Hi,s
Here once use country.size, it always return size equal to 0, even this picklist contain some value, that's way rendered="{!countries.size >0}" will always false. I don't understand what is wrong in this.
Regards,
Sandy
You need to return a list in your GETer.