I am currently trying to determine the appropriate timing for invoking a JavaScript function when a checkbox is set to true. The challenge lies in the fact that the checkbox has a dynamically generated name as it is part of a table populated from a database. Each checkbox is uniquely named based on the sequence number and a given name. Upon completion, the checkbox triggers an Ajax call to invoke a JavaScript function through a bean listener. I am using the JSF 2 datatable in this particular scenario.
Is there a way to validate whether the rowCheckbox is checked before triggering the JavaScript function (as indicated by the oncomplete ajax parameter)?
---
<h:selectBooleanCheckbox id="rowCheckbox">
<a4j:ajax event="valueChange" listener="#dashboardController.tableRowIndexEvent}" execute="@form" oncomplete="addMarker('${item.geoposition.latDecDeg}', '${item.geoposition.longDecDeg}', '${item.geoposition.locationName}')"/>
</h:selectBooleanCheckbox>
----
Best regards, Chris