HI Team
I have created some logic around handling error, but im not getting any error. The idea when a user leave @EditorFor must validate the message with image error. I have done this following, but its not working debug nothing, maybe missing something pls assist.
- // Model
- [Required(ErrorMessage = " This field is required")]
- [EmailAddress(ErrorMessage = "Invalid email address")]
- public string Email { get; set; }
- // View on Form
- class="form-group row">
- ="Email" class="col-sm-2 col-form-label">Email:
class="col-sm-4">- @Html.EditorFor(model => model.RegForm.Email, new { htmlAttributes = new { @class = "form-control", autofocus = "autofocus", placeholder = "Email" } })
- @Html.ValidationMessageFor(model => model.RegForm.Email, "", new { @class = "text-danger" })
- // Javascript
Chandresh PansuriyaPosted Jul 22, 2020, 1:57 PM
Farhan AhmedPosted Jul 22, 2020, 11:58 AM