View Full Version : NumberField bug

31 Jan 2012, 3:10 AM
It seems, like all number based field widgets are broken (see SpinnerField (http://www.sencha.com/forum/showthread.php?176314-SpinnerField-bug) as well).

The value within the NumberField doesn't seem to be saved properly:

public void onModuleLoad()
final NumberField<Integer> number = new NumberField<Integer>(new IntegerPropertyEditor());
final TextField text = new TextField();
TextButton button = new TextButton("muh");

button.addSelectHandler(new SelectHandler()
public void onSelect(SelectEvent event)

text.addValidator(new EmptyValidator<String>());
number.addValidator(new EmptyValidator<Integer>());

VerticalLayoutContainer con = new VerticalLayoutContainer();
con.add(text, new VerticalLayoutData(1, -1));
con.add(number, new VerticalLayoutData(1, -1));
con.add(button, new VerticalLayoutData(1, -1));
con.setPixelSize(400, 500);

And here are the steps:

focus textfield
focus numberfield => textfield blurs => textfield got an error marker
focus textfield again => numberfield blurs => numberfield got an error marker

Everything fine so far

type something into the textfield, focus numberfield => marker gone
type a number into the numberfield, focus the textfield again => marker still there

Even a validation using the button doesn't seem to change anything. It seems, like the field updates its value on blur event only once.

5 Feb 2012, 8:17 AM
I can also confirm this kind of behavior.
First I thought that it has something to do with my code,but going through source i saw that value is not saved properly.

Using 3.0beta2.

6 Feb 2012, 12:48 PM
Looks like this issue is related with the one I reported earlier:


19 Mar 2012, 1:43 PM
Confirmed this problem still exists in beta4. I'm not sure if it's the exact same bug. Is this being looked at? I don't see any replies in either thread. Seems like a fairly critical bug. It might be browser related. I'm using Firefox 10.0.2

My example is very simple.

1. Upon module start, click "Save"

Value: null

2. Input "1" and click "Save"

Value: null

3. Input "2" and click "Save"

Value: 2

public class Example extends Composite {

private NumberField<Integer> numberField = new NumberField<Integer>(new IntegerPropertyEditor());

private Button gwtButton = new Button("Save");

public Example() {
VerticalPanel vp = new VerticalPanel();
vp.setPixelSize(400, 300);
gwtButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
GWT.log("Value: " + numberField.getValue());

19 Mar 2012, 3:07 PM
We've made some changes to NumberField recently for mostly unrelated bugs. I've tried both DarekKay's and jonjanisch's test cases, and I can't seem to reproduce the issue with the latest code from subversion.

If you're building from subversion, please test with the latest source. If not, try this out again when the next release rolls around and see if you still notice the issue.

19 Mar 2012, 3:20 PM
Thanks Wesley.

For completeness, I tested both my example and Darek's code in both Firefox 10.0.2 and Chrome 17 and was able to reproduce both problems in beta4.

I don't think it matters, but in my example I'm using a GWT button. I ran Darek's with a ExtGWT TextButton.

I'm using GWT 2.4.0 with GXT beta4.