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
  • 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, 2018 at 8:30
  • @Ranga Thank you so much! I added the ReadValue getter setter in the controller Sep 9, 2018 at 17:26

1 Answer 1

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}">
...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .