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

NumericTextBox: problem with validation of step

3 Answers 598 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
Jesper
Top achievements
Rank 1
Jesper asked on 27 Jun 2012, 11:09 AM
Setting step for a NumericTextBox seems to only affect the behaviour of the spinners.
"Manual" user input is not validated, so the user can enter numerals that aren't multiples of the step value.
Neither does using a Kendo Validator work.

See this fiddle:

http://jsfiddle.net/Ns6sd/2/ 

3 Answers, 1 is accepted

Sort by
0
Accepted
Alexander Valchev
Telerik team
answered on 02 Jul 2012, 08:35 AM
Hi Jesper,

The step is not supposed to affect the user input, but only the spinners. This is the default behaviour of the NumericTextBox widget, the functionality that you are looking for is available in Kendo Slider.

Regarding validation, to enable it you will have to add the data-type="number" attribute to the corresponding input. For example:
<input id="box" data-type="number" step="50" min="0" max="100" />

For convenience I have updated your fiddle, please check the result: http://jsfiddle.net/valchev/Ns6sd/9/ 

I hope this helps.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jesper
Top achievements
Rank 1
answered on 02 Jul 2012, 10:45 AM
Many thanks for your answer.
I wasn't aware that the data-type attribute was required for validation to work. Perhaps the intended data-type could be inferred from the validations used? I'm thinking step would only ever be used with numbers?
0
Alexander Valchev
Telerik team
answered on 04 Jul 2012, 04:10 PM
Hello Jesper,

Thank you for the feedback, I will forward it to the team.

The numeric text box initialization changes the type of the input element to text for IE compatibility reasons. That is why in order to trigger the validation it is required to explicitly set the data-type attribute.

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