how do I find the checkbox is clicked or not in jsf?

HII have a page and it has check box and submit button. I want to pop up a message whether the checkbox is or not. can any on let me know if i can do this through java script. How can I get the value whether the check box is clicked or not.RegardsRishab.
[282 byte] By [RishabGuptaa] at [2007-11-27 5:55:58]
# 1
Can Anyone help for the issue raise by me.
RishabGuptaa at 2007-7-12 16:25:32 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

You can use the 'checked' property of the checkbox object (how intuitive).if (checkbox.checked) {

// handle

}

Also see http://www.w3schools.com/htmldom/dom_obj_checkbox.asp

This has actually nothing to do with JSF. It's just basic JS+DOM knowledge.

BalusCa at 2007-7-12 16:25:32 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Thanx for the reply Balu. I tried the way which u asked me but here I have some problem. Since I have a list of check box in a data table and the check box is created dynamically.

i tried with

function enableField(thisObj, thisEvent)

{

isNode1Selected = false;

var str;

//if (form1:tableEx1:0:checkbox2.checked) {

alert(document.getElementById('form1:tableEx1:0:checkbox2').checked);

//}

<h:selectBooleanCheckbox id="checkbox2"

styleClass="selectBooleanCheckbox"

valueChangeListener="#{pc_ProjectAdministration.handleCheckbox2ValueChange}"

value="#{varprojectData.projectName}"

title="click it to select or deselect"

onclick="enableField();"></h:selectBooleanCheckbox>

and it returns true only when I check the first one. Since it has 0. Can please suggest me the way where i can get true value if i select any of the check box.

Regards

Rishab

RishabGuptaa at 2007-7-12 16:25:32 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Make use of the 'this' reference in JS.
BalusCa at 2007-7-12 16:25:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...