Pattern validation not supported in input type as number

5 posts, 1 answers
  1. Rasika
    Rasika avatar
    18 posts
    Member since:
    Jul 2015

    Posted 28 Aug 2015 Link to this post

    I have 2 situations..............

    Number 1 : 

            <div id="container">      
            <input type="text" 
                   class="k-textbox" 
                   class="k-input k-textbox"
                   pattern="\d{10}"
                   data-pattern-msg="enter a value according to the pattern"
                   />
          <input type="button" value="validate" id="validateButton"/>
        </div>                  

        <script type="text/javascript">
          $("#container").kendoValidator();

          $("#validateButton").click(function () {
            $("#container").data("kendoValidator").validate();
          });
        </script> 

           This is working correctly. Please see​ above input type is text .

     

    Number 2 : 

            <div id="container">      
            <input type="number" 
                   class="k-textbox" 
                   class="k-input k-textbox"
                   pattern="\d{10}"
                   data-pattern-msg="enter a value according to the pattern"
                   />
          <input type="button" value="validate" id="validateButton"/>
        </div>                  

        <script type="text/javascript">
          $("#container").kendoValidator();

          $("#validateButton").click(function () {
            $("#container").data("kendoValidator").validate();
          });
        </script>​

     This is not working . Please see above input type is number.

     

    So is  "data-pattern-msg" is not supported for the input type "number" ???

     

     

  2. Rasika
    Rasika avatar
    18 posts
    Member since:
    Jul 2015

    Posted 29 Aug 2015 in reply to Rasika Link to this post

    Can someone help me on this ??
    I am really in mess............
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 01 Sep 2015 Link to this post

    Hello Rasika,

    Indeed, as shown in the documentation, the pattern attribute is not supported for type numeric. This also matches the HTML5 definition. If such usage is required in your case, you should consider implementing a custom validation rule which to handle it.

    Regards,
    Rosen
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  5. Rasika
    Rasika avatar
    18 posts
    Member since:
    Jul 2015

    Posted 02 Sep 2015 Link to this post

    So what happened when this scenario happen in grid update popup ??
    Do I have to do like this example ??
    Is this only way to do this ??
  6. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 03 Sep 2015 Link to this post

    Hello Rasika,

     

    If you are referring to how to attached custom validation rule to the built-in Validator instance of the Grid widget popup editor. Indeed, this is the way to do it.

     

    Regards,
    Rosen
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017