-
12 Jan 2011 5:59 PM #1
[FNR] NumberField allowing decimals when explicitly disabled
[FNR] NumberField allowing decimals when explicitly disabled
GWT Version: 2.1.0
GXT Version: 2.2.1
With a NumberField, I've limited the input to only allow Integers... (as described in the javadoc)
But the problem is the user can still enter decimals.Code:NumberField numberField = new NumberField(); numberField.setPropertyEditorType(Integer.class);
So I tried the using the setAllowDecimals feature
But the user can still enter decimals.Code:numberField.setAllowDecimals( false );
After debugging, I found onKeyPress method of SpinnerField was never reaching the allowed keys section of code, and was jumping out early due the decimal character being classed as a "special" key (Key number of 46)
Let me know if you want a more complete example, as per the guidelines.. I just figured this is such a simple bug to explain.
FYI: I found thread where someone had reported a similar problem for GXT 1.x -it may be caused by the same bug?
http://www.sencha.com/forum/showthre...ecimal+Integer
-
7 Feb 2011 2:04 PM #2
I hate it when people "bump" threads, 5 minutes after posting. But thought this was a fair amount of time to..... *BUMP*
Is this a confirmed bug? I was expecting there to be some feedback by now, saying it will be fixed in 3.x etc.
Cheers
Troy
-
30 Jun 2011 8:05 AM #3
I've had this same problem and ended up overriding the onKeyPress method to specifically check if the character is a '.'. The problem appears to be that the fe.isSpecialKey(getKeyCode(fe.getEvent()) logic doesn't work across all systems (I'm using a Mac)
-
1 Jul 2011 2:53 AM #4
This should be fixed in SVN now as of revision 2410
Thank you for reporting this bug. We will make it our priority to review this report.
Similar Threads
-
[1.2.1] NumberField (Integer) allows decimals
By jonjanisch in forum Ext GWT: Bugs (1.x)Replies: 0Last Post: 13 Jan 2009, 1:54 PM -
Allowing Zero (0) at the front of a NumberField?
By junkzilla in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 30 Oct 2008, 7:58 AM -
Force NumberField to display decimals
By thomas.de in forum Ext 2.x: Help & DiscussionReplies: 4Last Post: 29 Sep 2008, 6:35 AM -
Firefox 2.0 allows decimals in numberfield even though false
By thejoker101 in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 20 Mar 2007, 8:55 AM


Reply With Quote