Reputation:
I have the following example in my jsf xhtml page:
<h:selectBooleanCheckbox value="#{bean.fieldvalue1}" onchange="updateJsFunction(this);"/>
The parameter "this" for the js function "updateJsFunction" doesn´t includes the value of the selectBooleanCheckbox, which was selected or deselected.
Is there a way to assign the value of an selectBooleanCheckbox in a java script function?
Upvotes: 0
Views: 572
Reputation: 37051
You can replace onchange="updateJsFunction(this);"
with onchange="updateJsFunction(event);"
And then do what ever you want with $(event.target)
(if you use jQuery) or inspect the event.target
with js
Upvotes: 1
Reputation: 16999
Yes you have to work on the DOM. The 'this' you refer to is the generated HTML checkbox, you must see if it has the attribute 'checked'. If you use jQuery it would be something like:
jQuery(this).is(':checked')
Upvotes: 1