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

Pattern validation not supported in input type as number

4 Answers 789 Views
Input
This is a migrated thread and some comments may be shown as answers.
Rasika
Top achievements
Rank 1
Rasika asked on 28 Aug 2015, 08:06 AM

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" ???

 

 

4 Answers, 1 is accepted

Sort by
0
Rasika
Top achievements
Rank 1
answered on 30 Aug 2015, 04:38 AM
Can someone help me on this ??
I am really in mess............
0
Accepted
Rosen
Telerik team
answered on 01 Sep 2015, 09:11 AM

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!
 
0
Rasika
Top achievements
Rank 1
answered on 02 Sep 2015, 05:40 AM
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 ??
0
Rosen
Telerik team
answered on 03 Sep 2015, 06:07 AM

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!
 
Tags
Input
Asked by
Rasika
Top achievements
Rank 1
Answers by
Rasika
Top achievements
Rank 1
Rosen
Telerik team
Share this question
or