Note that there are some explanatory texts on larger screens.

plurals
  1. PORemote validation work but form not post
    text
    copied!<p>I am using Remote validation on two field Email and CNIC.Remote Validation work proper but when i clik on submit button form not post.When i remove remote validation on both of fileds form post the data.</p> <p>Model</p> <pre><code>Public class VMModel{ [Remote("Function","Controller",ErrorMessage = "The CNIC already exists")] public string CNIC { get; set; } [Remote("Function2", "Controller", ErrorMessage = "The Email already exists")] public string Email { get; set; } } </code></pre> <p>Controller</p> <pre><code> public JsonResult Function2(string Email) { bool IsExist = true; if (Membership.GetUser(Email) != null) { IsExist = false; } return Json(IsExist, JsonRequestBehavior.AllowGet); } public JsonResult Function(string CNIC) { bool IsExist = true; if (GetUserByCNIC(CNIC) != null) { IsExist = false; } return Json(IsExist, JsonRequestBehavior.AllowGet); } [HttpPost] public ActionResult Create(VMModel model) { return View(model); } </code></pre> <p>View Code </p> <pre><code>&lt;script src="&lt;%: Url.Content("~/Scripts/jquery.validate.min.js") %&gt;"type="text/javascript"&gt;&lt;/script&gt; &lt;script src="&lt;%: Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js") %&gt;" type="text/javascript"&gt;&lt;/script&gt; &lt;%using (Html.BeginForm("Create", "Controller", FormMethod.Post, new { enctype = "multipart/form-data"})) { %&gt; &lt;fieldset&gt; &lt;div class="inner_left"&gt; &lt;div class="editor-label"&gt; &lt;%: Html.LabelFor(m =&gt; m.Email)%&gt; &lt;/div&gt; &lt;div class="editor-field"&gt; &lt;%: Html.TextBoxFor(m =&gt; m.Email)%&gt; &lt;%:Html.ValidationMessageFor(m =&gt; m.Email)%&gt; &lt;/div&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;div class="editor-label"&gt; &lt;%: Html.LabelFor(m =&gt; m.CNIC)%&gt; &lt;/div&gt; &lt;div class="editor-field"&gt; &lt;%: Html.EditorFor(m =&gt; m.CNIC)%&gt; &lt;%:Html.ValidationMessageFor(m =&gt; m.CNIC)%&gt; &lt;/div&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;p style="text-align:left;margin-left: auto;margin-right: auto;width: 400px;"&gt; &lt;input type="submit" class="hrbutton" value="Create" /&gt; &lt;/p&gt; &lt;/fieldset&gt; &lt;% } %&gt; </code></pre> <p></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload