ASP.NET MVC Remote validation hook method

ragon

New Member
Is it possible to add a hook method on the client side with a remote validation?I want to check if an email is already taken and if that is true i want to add a button on my form that will show the user with that email address.note I also check if email is required and or a valid e-mail. the button should only show when an email is already in de database.(the validation itself works, I just want to catch the event and add a button to my view)here is my code in the model\[code\] <Remote("ValidateEmail", "User", additionalfields:="UserGuid,PersonGuid", ErrorMessageResourceType:=GetType(Resources.Messages), ErrorMessageResourceName:="UserErrorDuplicateEmail")> Public Property Email As String\[/code\]my javascript\[code\]function createValidationCheck() {$("form input").change(function () { console.log("change") $("form").valid();});$("form").validate({ invalidHandler: function (event, validator) { console.log("TESTING") }})}\[/code\]this is part of my view\[code\]@Using (Ajax.BeginForm("SaveUserDetail", New AjaxOptions With {.HttpMethod = "Post", .UpdateTargetId = "displayContainer", .OnFailure = "PostFailure", .OnSuccess = "fillDisplayContainer", .OnComplete = "userDetailFinished" })) @<div id="detailInformation"> <h2>@Resources.Labels.UserDetails</h2> @Html.HiddenFor(Function(m) m.UserGuid) @Html.HiddenFor(Function(m) m.PersonGuid) <div class="label"> @Html.LabelFor(Function(m) m.Email) </div> <div class="displayForCorrector"> @Html.TextBoxFor(Function(m) m.Email) @Html.ValidationMessageFor(Function(m) m.Email,Nothing,New With{.id ="ShowEmailList"}) </div>\[/code\]In short,How can I catch the validation event and add behaviour to it via jquery?
 
Top