I am currently working on GWT.
I am stuck with CheckBoxGroup ..
how can I gropu my checkboxes under one name?
like in java i can use
CheckboxGroup entreeGroup = new CheckboxGroup();
and then add.()..
but in GWT add() is not there..
Please help.
GWT generates Javascript which in turn produces HTML. In HTML, to group checkboxes together, you simply set the same name on all of them. GWT uses the same technique.
Use
getElement().setAttribute("name","your_checkbox_group_name");on all your checkboxes. http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/dom/client/Element.html#setAttribute(java.lang.String,%20java.lang.String)There may be some code that does the same but I am unaware of it.
EDIT:
As mentionned by Ganesh Kumar, if what you expect is to have only a single checkbox selected at a time, then you are looking for RadionButtons. They take a “name” argument in their constructor in order to identify a same group of RadioButtons