I have a TabPanel with a tab that holds a Composite in which are a
couple of RadioButtons that are grouped together. They were created
with
RadioButton rbOne = new RadioButton("myGroup")
RadioButton rbTwo = new RadioButton("myGroup")
In a tab next to it I inherited from this class and added some extra
form fields. The constructor of the superclass selected the default
option in the RadioButton group by calling
rbOne.setChecked(true)
This worked fine in Hosted mode and in IE. When the app launched, each
tab would display the RadioButton group with the first one selected.
Not so joyous in Firefox. The first tab had neither rbOne or rbTwo
selected but on the tab with the subclass, rbOne was checked as
expected.
The fix for it was having a name for the RadioButton group that was
specific to the class, set by a method called by the constructor and
overridden by the subclass. It seems that Firefox selects the 2nd
rendered RadioButton group when there are more than one with the same
name.
Alex
that could be realted how browsers DOM is constructed, If FireFox
stores references in hashed arrays that obvioiusly using the same
element with the same identifier will make your first widget
unselectable,
just guessing,
what about:
public void onModuleLoad() {
RootPanel rootPanel = RootPanel.get();
Counter c = new Counter("myGroup");
RadioButton rbOne = new RadioButton(c.toString());
RadioButton rbTwo = new RadioButton(c.toString());
rootPanel.add(rbOne);
rootPanel.add(rbTwo);
}
static class Counter {
private static int tick = 0;
private String name;
public Counter(String name) {
this.name = name;
}
/* @Override */
public String toString() {
return name + (Counter.tick++);
}
}
regards,
Peter