Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140131

MVC client side validation for PhoneAttribute

$
0
0

I have a model:

public class MyModel{
    [Phone]
    public string MyTel { get; set; }
}

in the view:

@model MyModel
@Html.EditorFor(x => x.MyTel)

the HTML generated:

<input type="tel" value="" name="MyTel" id="MyTel" data-val-phone="The MyTel field is not a valid phone number." data-val="true" class="text-box single-line"/>

the client side validation for the MyTel field does not working. How to make this work?


Viewing all articles
Browse latest Browse all 140131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>