0

I'm trying to read an integer value from the controller and render it as a checkbox in my Visual force page. If 1 render it as checked and if 0 render it as unchecked. I get a compilation error Unknown property 'readValue'. If I simply did a apex:inputcheckbox selected="true" it doesn't work either.

    <apex:datatable value="{!classRows}" var="class" id="classTable"
        <apex:inputhidden value="{!class[column01.FieldName]}" id="hvl01" rendered="true" />
        <apex:variable var="readValue" value="{!IF(class[column01.FieldName]=1,true,false)}" id="testread" />
        <apex:outputtext value="{!readValue}" />
        <apex:inputcheckbox selected="{!readValue}" id="chk01" />
     </apex:datatable>      
  • 2
    Do you have a public Boolean attribute in your controller called readValue? i.e: public Boolean readValue {get;set;} Also you need to set the merge field as the value in the input checkbox <apex:inputCheckbox value="{!readValue}"> – Ranga Sep 9 '18 at 8:30
  • @Ranga Thank you so much! I added the ReadValue getter setter in the controller – Donald Reagan Sep 9 '18 at 17:26
3

Please make sure that you have a boolean attribute defined in your controller named readValue.

Controller:

...
public Boolean readValue {get;set;}
...

Also in your page set the value of the input checkbox as follows:

Page:

...
<apex:inputCheckbox value="{!readValue}">
...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.