NumericTextBox: problem with validation of step

4 posts, 1 answers
  1. Jesper
    Jesper avatar
    25 posts
    Member since:
    Jun 2012

    Posted 27 Jun 2012 Link to this post

    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/ 
  2. Answer
    Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 02 Jul 2012 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Jesper
    Jesper avatar
    25 posts
    Member since:
    Jun 2012

    Posted 02 Jul 2012 Link to this post

    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?
  5. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 04 Jul 2012 Link to this post

    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!
Back to Top
Kendo UI is VS 2017 Ready