asp.net mvc 3 - Required Validation Error Message is not getting displayed in jquery popup modal form -
I used the In one of my fields, I have used both [essential] and [regular expression] when I input incorrect input in the text box, then the RegualExpression verification message appears and after deleting the input, Only required verification message Otherwise, the required verification message does not appear. Here's my code: - Model class - Controller ComponentModel.DataAnnotations attribute for the verification code [Required] attribute. Although the form is not appearing in, regular expans verification and range validation are working fine.
public class email {[required (error message) = "email address is required!" )] [Regular expression ("^ ([a-zA-Z0- 9_ \\ - \\.] +) @ ((\ \ [[0- 9] {1,3} \ \ [0-9] ] {1,3} \\. [0- 9] {1,3} \\.) | (([A-zA-Z0-9 \\ -] + \\.) +)) ([A- ZA-Z] {2,4} | [0- 9] {1,3}) (\\]?) $ ", Error message =" invalid email address. ")] {Receive public virtual string email address; Set; } [Required (AllowEmptyStrings = false, ErrorMessage = "First name is required")] Public Virtual String Firstname {get; Set; } Public Virtual String MiddleName {get; Set; } [Required (error message = "Last name is required!")] Public Virtual String LastName {get; Set; } Public virtual string status {received; Set; }}
@ {Html.EnableClientValidation ();}
[HTTPPT] Make public actional content email () {if (request.saaxxurist ()) {var list = new selectList (new [] {New {id} "active", name = "active"}, new {id = "idle", name = "idle"}}, "id", "name", 1); See data ["status"] = list; Back partial view ("_EmailEmail"); } Redirect return action ("index"); } [HTTPPist] {if (ModelState.IsValid)} {_emailRepository.Create (model)} using the Public Action Result e-mail (e-mail model) {(_emailRepository); Return Jason (new {success = true}); } Redirect return action ("index");
$ (document) .ready (function (e) {$ ("form") .validate (). Element ("#FirstName"); $ ("form"). Validate () Element ("#LastName");});
Comments
Post a Comment