Completed
Last Updated: 20 Nov 2014 18:46 by ADMIN
Imported User
Created on: 07 Oct 2012 18:42
Category: Kendo UI for jQuery
Type: Feature Request
7
Allow the user to enter negative numbers in the NumericTextBox
In the NumericTextBox typing the character "-" is not allowed meaning that the user can not directly type a negative number.  The only way for a negative number to be specified is by clicking the down arrow to progress below 0 to get the dash to show up.
9 comments
ADMIN
Brandon
Posted on: 16 Nov 2012 21:44
verified this behavior in FF 16 on Win8. Will fix.
Greg
Posted on: 14 Nov 2012 18:29
This is not working in Mozilla Firefox.  Open the jsbin link provided by the Admin in Mozilla and you will easily see this is not working.
Ólafur Gíslason
Posted on: 04 Nov 2012 16:07
I have exactly the same problem, the numeric keypad "-" works but not on the regular keyboard.
Imported User
Posted on: 29 Oct 2012 22:09
If you type a hyphen into the demo box here (http://api.jquery.com/keyup/), what keycode do you get?  I get 173 for the hyphen and 109 for the minus sign.  NumericTextBox gives the same behavior on my officemate's computer, too, even though it's a totally different model (still Windows 7, though).

I just noticed, this only happens on Firefox (16.0.2).  I tried your example in Chrome and IE, and it works as you'd expect.
ADMIN
Brandon
Posted on: 29 Oct 2012 20:37
I've tested this on three separate machines, OSX an Windows, with the numeric keypad and the combined minus/hyphen key and cannot duplicate this behavior. It worked for me in every case.
Imported User
Posted on: 29 Oct 2012 18:41
When you get a keypress event, minus and hyphen have the same code (ascii 45 or 0x2d).  When you look at keydown or keyup, though, minus is code 109 and hyphen is 173.

I think the relevant code is in _prevent: function(key), in kendo.numerictextbox.js (and mirrored in kendo.all.js, kendo.web.js, and the min.js versions).

(key == 189 || key == 109)
could be
(key == 189 || key == 109 || key == 173)
Imported User
Posted on: 27 Oct 2012 00:35
Brandon Satrom: I can't type a hyphen into your example (http://jsbin.com/elohuw/1/).  As Anonymous said, the minus sign on the numeric keypad works, but the hyphen that shares a key with the underscore fails.  Of course, many laptops don't have a numeric keypad.
Roman
Posted on: 25 Oct 2012 12:25
Minus sign works only with numeric keypad. '-' on regular keybord doesn't work.
ADMIN
Brandon
Posted on: 08 Oct 2012 03:43
Hi Brandon,

I'm unable to replicate this behavior using a bare-bones NumericTextBox in JSFiddle. Can you check the following and compare against your implementation. Perhaps you have a config mismatch?

http://jsbin.com/elohuw/1/