View Full Version : [FNR] NumberField not working in Firefox 3.6.11
chonghaulim
2 Nov 2010, 8:18 AM
I use the following code in my app and it is working in anything but Firefox 3.6.11. I couldn't type anything including numbers in the field.
NumberField amount = new NumberField();
field.setName("amount");
field.setFieldLabel("Amount");
field.setFormat(NumberFormat.getDecimalFormat()); // The same result for any other format
field.setAllowDecimals(true);
field.setAllowBlank(false);
Did I do something wrong?
You are probably using GWT 2.1 and this is nto yet supported (due to braking changes). We will release an updated build soon. Please note that this is a duplicate report.
I commited a first fix for this to SVN at revision 2317
nastra
26 Jan 2012, 4:50 AM
Can I see somewhere the changes that were done by your fix? As currently I can only see that something was done in a particular file, but not what exactly. This would be really helpful.
The_Jackal
30 Jan 2012, 2:51 PM
Note that this was fixed in 2.2.2 (which is pretty old now).
Here are the changes anyway:
- onKeyDown removed
- onKeyPress changed
@Override
protected void onKeyPress(FieldEvent fe) {
super.onKeyPress(fe);
if (fe.isSpecialKey(getKeyCode(fe.getEvent()))) {
return;
}
char key = getChar(fe.getEvent());
if (!allowed.contains(key)) {
fe.stopEvent();
}
}
The following methods / fields added for 2.1 support:
private int lastKeyCode;
private native char getChar(NativeEvent e) /*-{
return e.which || e.charCode || e.keyCode || 0;
}-*/;
private native int getKeyCode(NativeEvent e) /*-{
return e.keyCode || 0;
}-*/;
nastra
30 Jan 2012, 11:30 PM
This is very helpful, thanks for that
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.