I want to get p:selectBooleanCheckbox
component and check if it is selected or not using javascript
<h:dataTable value="#{controller.list}" var="item">
<h:column>
<f:facet name="header">Ratio1</f:facet>
<h:panelGrid columns="2">
<p:inputText id="ratio1" readonly="#{true}" disabled="true" styleClass="ratio1"/>
<h:outputText value="%" />
</h:panelGrid>
<p:selectBooleanCheckbox id="report1" onchange="calculateTotalRatio()" value="#{controller.value}" valueChangeListener="#{fISHController.onCaseTestItemPatternReportFlagChange()}">
</p:selectBooleanCheckbox>
</h:column>
I want on calculateTotalRatio()
function check if the checkbox is checked or not and depending on it update ratio1 input text with value
You can define the widgetVar of your selectBooleanCheckbox
You can access in js the Primefaces object in these ways
So, to get the checkbox state you can use