function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rupesh Ranjan 5Rupesh 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;
   }
  


}


 
Rupesh Ranjan 5Rupesh Ranjan 5
I already checked it still have an issue
Dilip_VDilip_V
Rupesh,

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.

 
SalesFORCE_enFORCErSalesFORCE_enFORCEr
Try this
<apex:page controller="DisplayPicklistvalue">
<apex:form >
    <apex:pageBlock title="Country">
    <table>
      <apex:repeat value="{!Countries}" var="a">
       <td>
         <apex:outputText value="{!a}"></apex:outputText>
         <apex:inputCheckbox/>
       </td>

      </apex:repeat>
      </table>
   </apex:pageBlock>
   </apex:form>
   </apex:page>
Kakasaheb EKKakasaheb EK
Thermo,
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.