I am trying to use client side validation and its not working. My model is:
[Required]
[DataType(DataType.EmailAddress)]
public string Email { get; set; }
my layout used by the view has:
<script src="~/js/jquery-3.6.0.min.js" type="text/javascript"></script>
<script src="~/js/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>
<script src="~/js/jquery.validate.js" type="text/javascript"></script>
my view has:
<div class="form-group">
<label asp-for="Email"></label>
<input asp-for="Email" class="form-control" />
<span asp-validation-for="Email" class="text-danger"></span>
</div>
when I check the form html in the browser it shows:
<div class="form-group">
<label for="Email">Email</label>
<input class="form-control" type="email" data-val="true" data-val-required="The Email field is required." id="Email" name="Email" value="">
<span class="text-danger field-validation-valid" data-valmsg-for="Email" data-valmsg-replace="true"></span>
</div>
but when I click the submit button, the form is been posted to the server which means the client side validation is not working.