I need to know how to iterate through a list of primefaces p:selectBooleanCheckbox elements and find out rather or not they have been checked. I have found out how to find them but not how to actually get rather or not they are true or false, I was wondering if anyone here would be able to assist with this.
In as little code as possible this is what I am currently doing to get the actual element returned to me, I have used the jquery :checked as well as .val() and a few other methods but none seem to work. I have also tried sifting through the code in the element object in the console looking for anything that stands out and I haven't been able to find anything either. Any help would be greatly appreciated.
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<body>
<ui:composition template="./../../WEB-INF/template.xhtml">
<ui:define name="content">
<div style="margin-bottom: 350px;">
<p:outputLabel for="coop_sent" value="CO-OP Sent"/>
<p:selectBooleanCheckbox name="coop_sent" styleClass="pc" widgetVar="coop_sent" id="coop_sent" value="#{editProjectsBean.pc.co_opSen}"/>
<script type="text/javascript">
for (var propertyName in PrimeFaces.widgets) {
if (PrimeFaces.widgets[propertyName] instanceof PrimeFaces.widget.SelectBooleanCheckbox){
if (PrimeFaces.widgets[propertyName].widgetVar === 'coop_sent') {
console.log($('PrimeFaces.widgets[propertyName].widgetVar.coop_sent'));
}
}
}
</script>
</div>
</ui:define>
</ui:composition>
</body>
</html>