jeudi 19 janvier 2017

JSF checkbox is not retaining the value after adding ID attribute

I have the below code in my JSF page for a checkbox.

<h:selectBooleanCheckbox value="#{ds.nonPromoted}"  
styleClass="checkNPD#{ds.dealSheetNo}">
<f:ajax execute="@form" render="@form :frmMessage:hdrMessages"
event="valueChange" listener="#{dealSheetBean.nonPromoCheck(ds.dealSheetNo)}" 
onevent="fnAjaxRequestHandlerIncl" />
</h:selectBooleanCheckbox>

It was working fine previously. But after adding the id="checkNPD1#{ds.dealSheetNo}" attribute in h:selectBooleanCheckbox , the checkbox is not checking properly. Once the page is reloaded, the checkbox become unchecked(The value is not retained neither in Java).

When I inspect the HTML in browser, the ID is populated as frmDealSheet:rptDealSheet:0:checkNPD1. The ds.dealSheetNo has a value which is not reflected in the ID attribute.

Can anyone advice why this not working and how can this be fixed?




Aucun commentaire:

Enregistrer un commentaire