jsfmanaged-beanselectbooleancheckbox

JSF boolean property not getting updated selectBooleanCheckbox


I am trying to update a boolean in the backend from the html. I found that h:selectBooleanCheckbox could to that. I have put it in my xhtml like this:

<h:dataTable var="row" value="#{generalBean.organisations}">
        <h:column>
            <h:selectBooleanCheckbox value="#{row.enabled}">
                <p:ajax update="lineChart" />
            </h:selectBooleanCheckbox>
        </h:column>
        <h:column>
            <h:outputText value="#{row.name}"/>
        </h:column>
</h:dataTable>

It retrieves the enabled property fine but when I untick the checkbox it doesn't get update in the Organisation model.

Am I doing something wrong? I do have getters and setters for the enabled property.

PS: the ajax update is for a chart that needs to be updated when the checkbox is unticked.


Solution

  • The checkbox wasn't inside a <h:form>. I have put it in a form and now it works.