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

[Solved] Prevent replacing users value with minValue

3 Answers 62 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Steven
Top achievements
Rank 1
Steven asked on 26 Apr 2012, 07:42 PM
In your online demo for the currency textbox, if I set the minimum value to 0.01, and then enter a value of 0.00, when I tab out the value I entered is replaced by the minimum value. Similar behavior occurs for the maximum value. How do I prevent that?  I want the user to see an error message, and actually enter a correct value - I don't want the control to replace a user's value automatically. 

If for instance, the maximum value is 9,999.99, and the user accidentally enters 10000 when they meant to enter 1000 (key-bounce adds an additional 0 they do not notice), then textbox is automatically setting the value to  9999.99. This is VERY BAD BEHAVIOR! For financial applications this could result in a disastrous transaction.

3 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 02 May 2012, 11:23 AM
Hello Steven,

You can disable the min and max configuration for the numeric textbox. Thus the numeric will not replace the value with the min/max values. Hence you cannot rely on the built-in validation to the Numeric-textbox but to the client/server validation enabled for that page. 

All the best,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Steven
Top achievements
Rank 1
answered on 02 May 2012, 07:19 PM
I think you're missing the point. If I set a max value, and the user makes a mistake and accidentally enters a value too large, the user should see an error message - the application should not "magically" change the value he entered.

As an example, if I set the max value to 999.99 and the user enters 10000 because they meant 100.00 and  think the application might put in the decimal point (some accounting programs do that), or they "bounced" the keys and didn't notice, the Telerik control will automagically convert the value to 999.99 without notifying the user their value
a. was incorrect
b. it was changed from what they entered.

If the user is intending to transfer money, their account will be debited for 999.99 instead of the 100.00 they really meant.

THIS IS REALLY BAD BEHAVIOR!!!!
0
Petur Subev
Telerik team
answered on 04 May 2012, 11:43 AM
Hi again Steven,

The Min and Max options prevent the user to enter invalid values to the numeric textbox (any number greater than the max value will be converted to the max value - same logic goes for the min value).
As I already stated in my previous post you can remove them(max and min options) and the numeric text will not prevent entering invalid values - it is the validation (client and/or server side) that will inform the user in appropriate way that the value entered is not valid for that field.

All the best,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
NumericTextBox
Asked by
Steven
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Steven
Top achievements
Rank 1
Share this question
or