You need to sign in to do that
Don't have an account?
Rupesh Ranjan 5
Error: Read only property 'DisplayPicklistvalue.Countries'
Vf
<apex:page controller="DisplayPicklistvalue"> <apex:form > <apex:pageBlock title="Country" > <apex:pageBlockTable value="{!Countries}" var="a"> <apex:column headerValue="{!Countries}" > <apex:inputCheckbox value="{!Countries}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock>Controller
public class DisplayPicklistvalue { public List<String> getCountries() { List<String> options = new List<String>(); Schema.DescribeFieldResult fieldResult = OfficeLocation__c.Country__c.getDescribe(); List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues(); for( Schema.PicklistEntry f : ple) { options.add(f.getvalue()); } return options; } }
You forgot to add set{get;set;} attribute that's why you are getting that error message.If you add only get method then it will be read only.
Let me know if you have any issues.
Mark it as best answer if it works/
Thanks.
You have given perfectly correct answer..!!
for others just update the getter and setter property...your read only error will get resolved.
public String[] countries{get;set;}
public SampleCon1(){
countries=new String[]{};
}
Thanks,
Sachin.