Can please someone explain to me how can i add a click event on a checkbox in my form. i have tried check,change,handler but they all seem to fire when the form loads, something that i don't want to. i simply want to alert the user with a message when he clicks on the checkbox.
I'd actually suggest CheckBox.addValueChangeHandler. This will give you several kinds of changes:
o Any toggle of the checkbox (click or space bar)
o Any click on the label to the right of the checkbox (This text is set via CheckBox.setBoxLabel)
o Any invocation of CheckBox.setValue(newValue, true) - the second parameter set to true means 'fire a valuechangeevent'.
ChangeEvent won't go off in the second two cases, ClickEvent won't go off in at least the last case and perhaps more.
ChangeEvent and ClickEvent are the DOM events themselves, while ValueChangeHandler is a logical event, sent by the widget, only in cases that make sense.