This is a migrated thread and some comments may be shown as answers.

NumericTextBox for Large Values

5 Answers 150 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
Safira
Top achievements
Rank 1
Safira asked on 14 Jan 2014, 04:26 PM
Hey guys,

I'm using Kendo with MVC 3 and Html Helpers.

I need to receive possible large currency values, up to 19 digits and 2 decimal places, always positive. I have used the Min and Max methods, but I am observing a very peculiar behavior. 

For reproducing purposes the values I'm using are:
   Min()  - 0
   Max() -  9999999999999999999.99

Behaviors:

I write 17 digits 1's ( 11.111.111.111.111.111 ), after losing focus, the NumericTextBox shows me a random 2 instead of 1 at the end (  11.111.111.111.111.112 ).
After that, it seems like any digit I input is being transformed and presented incorrectly. Some times the number presented, and the number that actually exists in the NumericTextBox are different (on edit mode, and view mode). The decimal place values are also transformed incorrectly after 

At one point the value becomes ( 10.000.000.000.000.000.000 ), that is 20 digits with no decimal places. And I can't go above that, nor can I add any decimal place values to it.

There seems to be a lot of issues with the NumericTextBox control to numbers with more than 15 digits. Is this a known bug? Am I doing something wrong. Any help would be extremely helpful.

Thank you.




5 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 16 Jan 2014, 09:58 AM
Hello,

The NumericTextBox uses JavaScript Number object, which looses precision after 16th digit. You can find more information about Number object here. In order to overcome this language limitation I would suggest you define the max value of the widget less then 16 digits number.

Regards,
Georgi Krustev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Safira
Top achievements
Rank 1
answered on 16 Jan 2014, 11:08 AM
Thank you for your quick reply.

I understand the issue, but unfortunately, limiting the values to 16 digits is not an option.

Do you have any other suggestion to try and overcome this issue? I'm sure I am not the first person to use large numeric values.

Thank you again.
0
Accepted
Georgi Krustev
Telerik team
answered on 16 Jan 2014, 05:02 PM
Hello again,

As this issue is directly related to the Number object limitation, the only workaround that I can suggest is to use a regular <input type="text" /> and a client validation. Thus longer text will be allowed and the client validation will help you to insure the validity of the user input.

Regards,
Georgi Krustev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Safira
Top achievements
Rank 1
answered on 17 Jan 2014, 11:56 AM
Thank you for your reply.

Using a text control does seem to be the only option at this point. 

I would like to create a ticket to have this issue resolved in future versions of Kendo if possible. And also I believe you should have this restriction in your documentation, even if it is a restriction on the javascript object.

Thank you again for your support.
0
Georgi Krustev
Telerik team
answered on 17 Jan 2014, 02:00 PM
Hello,

We will document this limitation in order to avoid any misunderstandings. 

You can open a discussion on the subject in our UserVoice portal. Thus we will able to gather community feedback.

Regards,
Georgi Krustev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
NumericTextBox
Asked by
Safira
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Safira
Top achievements
Rank 1
Share this question
or