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

[Solved] Re: Can't enter decimal as first character

4 Answers 65 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.
-glenn-
Top achievements
Rank 1
-glenn- asked on 26 Jul 2011, 01:50 PM
[Yesterday and today I've tried to post the below as a reply to this thread:
http://demos.telerik.com/aspnet-mvc/razor/NumericTextBox
but keep getting a "sorry there's a problem with our server".]


I've run into this problem too. How come I can enter, say, ".34" (no quotes, of course) into the first control (#NumericTextBox) on this page:

http://demos.telerik.com/aspnet-mvc/razor/NumericTextBox

but it doesn't allow the initial "." on my own page?

Is there a new version of the control being used on the demo page?

Thanks!

4 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 27 Jul 2011, 09:27 AM
Hi -Glenn-,

 This is not a known issue. Check this screen cast, which I have made while testing on our online demos.

Greetings,
Georgi Krustev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

0
-glenn-
Top achievements
Rank 1
answered on 27 Jul 2011, 01:28 PM
Hi Georgi. I understand that, as I indicated in my post. What I don't understand is why it's not working for me. I have a field of type C# double with a RangeAttribute specifying it can have a value of 0 to 30. And here's the Razor code for the field:

@(Html.Telerik().NumericTextBoxFor(model => model.VentingVacuum).Spinners(false))

I can enter "0" into the rendered control and the Telerik control reformats it as "0.00" and accepts the field. I can enter "0.2" which is reformatted to "0.22" and is accepted. If I clear out the field then try to type a "." nothing is echoed; I must type "0." in order for the "." to be accepted. In other words, I must enter "0.2" and cannot enter ".2".

Here is the rendered HTML:

<div class="t-widget t-numerictextbox" id="VentingVacuum"><input class="t-input" data-val="true" data-val-number="The field Venting Vacuum must be a number." data-val-range="The field Venting Vacuum must be between 0 and 30." data-val-range-max="30" data-val-range-min="0" data-val-required="The Venting Vacuum field is required." id="VentingVacuum-input" name="VentingVacuum" value="0" /></div>

and the validation JavaScript:

jQuery('#VentingVacuum').tTextBox({val:0, step:1, minValue:0, maxValue:30, digits:2, groupSize:3, negative:1, text:'Enter value', type:'numeric', inputAttributes:{}});

Any ideas?
0
Georgi Krustev
Telerik team
answered on 29 Jul 2011, 09:20 AM
Hello -Glenn-,

 
I am not sure where could be the issue. Probably there is different regional settings or the keyboard layout is not standard. I will need to replicate the issue locally in order to help you further.

All the best,
Georgi Krustev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

0
-glenn-
Top achievements
Rank 1
answered on 09 Aug 2011, 07:00 PM
Figured it out. In my domain class I had something like this:

public const int MIN_VALUE = 1;
public const int MAX_VALUE = 10;
[Display(Name=
"Field Name Here")]
[Range(MIN_VALUE, MAX_VALUE)]
public virtual double? Value { get; set; }

The const's should be double not int!

While this was a coding bug perhaps the control could be taught to check the type of the Range values and upcast to double (in this case)? Or maybe issue a warning or error? Just a thought.
Tags
NumericTextBox
Asked by
-glenn-
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
-glenn-
Top achievements
Rank 1
Share this question
or