remote-validation

Remote Attribue Validation not firing in Asp.Net MVC

一笑奈何 提交于 2019-12-19 03:21:48
问题 Here is my model code public class BlobAppModel { [Required(ErrorMessage="Please enter the name of the image")] [Remote("IsNameAvailable","Home",ErrorMessage="Name Already Exists")] public string Name { set; get; } } And in my controller I have public JsonResult IsNameAvailable(string Name) { bool xx= BlobManager.IsNameAvailable(Name); if (!xx) { return Json("The name already exists", JsonRequestBehavior.AllowGet); } return Json(true, JsonRequestBehavior.AllowGet); } And in my data I have

Forcing a revalidate on mvc3 unobtrusive remote validation

不问归期 提交于 2019-12-18 13:15:13
问题 It's a classic login flow. The user can choose between 'new user' or 'existing user'. If the user is new, the name in the login box should validate against the server to see if the username is unique, if it's an existing user this check will be skipped since we expect the username to be taken already (ofcourse). I added a [Remote] attribute on the viewmodel and added the radiobutton for new/exiting user as 'additional fields'. This way the remote validation will just return true if it's an

Remote validation causes submit inputs (multiple-submit-buttons) to be null

白昼怎懂夜的黑 提交于 2019-12-12 05:19:09
问题 I recently implemented remote validation in my form: ViewModel: [Remote("IsTagUnique", "myController", "myArea", ErrorMessage = "This tag already exists.")] public string tag { get; set; } Controller: public ActionResult IsTagUnique(string tag) { using (db) { try { var myTag = db.ASAuftraege.Single(m => m.tag == tag); return Json(false, JsonRequestBehavior.AllowGet); } } catch (Exception) { return Json(true, JsonRequestBehavior.AllowGet); } } } [HttpPost] [ValidateAntiForgeryToken] public

How to create an custom remote validation attribute with dynamic additiional fields in ASP.NET MVC

本小妞迷上赌 提交于 2019-12-11 13:46:39
问题 I am developing an ASP.NET MVC5 project. In my project I am creating remote validation. For that I just created an custom validation attribute to support server-side validation. My remote validator working fine when remote action has to catch only one field. But I am having problems when I try to bind additional field for it. I mean when I validate with extra fields. Here is my custom remote validation attribute public class RemoteClientServerAttribute : RemoteAttribute { protected override

How to show the ajax loader image while remote validating using data annotation in asp.net mvc3

余生颓废 提交于 2019-12-11 11:32:17
问题 in my asp.net mvc3 application i am doing remote validation if a user already exist using data annotation . it is working perfectly . i was wondering if there is any why i can show the ajax loader image beside the input field in the form while remote validation(ajax request) is taking place. please help me Thanks 回答1: I don't think you can do it without writing the validation code yourself. See this article: http://www.highoncoding.com/Articles/767_Remote_Validation_in_ASP_NET_MVC_3.aspx

MVC3 Remote Validation

∥☆過路亽.° 提交于 2019-12-11 06:45:41
问题 I am currently in the proccess of setting up remote validation using MVC3 so that a user is alerted if their chosen username already exists. Everything is set up and working correctly appart from the most important part, the error message not being displayed. If I submit the form the error message is displayed as the the page is refreshed with the relevant model state error added. Is there anyway to refresh the model validation summary with a Json result? 回答1: Sample code: Web.config must

How to get unobtrusive jquery remote validator to perform async..?

坚强是说给别人听的谎言 提交于 2019-12-09 17:00:51
问题 In an MVC3 app, using jquery unobtrusive validation, and a view/model with a [Remote] validator: I am trying to disable the submit button and display a wait icon during remote validation, and when a valid form is submitted to the server. I thought I had it nailed until I tried it in IE8. The problem was, GC and FF were not firing the form's submit event when the form was invalid, so I just disabled the submit button during this event. However IE8 is firing this event when the form is invalid,

Parameter Name in Remote Model Validation Action of MVC3

回眸只為那壹抹淺笑 提交于 2019-12-09 07:14:03
问题 I use Remote validation attribute for SSN property, In view Page I use generic view then the ssn field is like: @Html.EditorFor(model => model.MainModel.SSN) @Html.ValidationMessageFor(model => model.MainModel.SSN) and My Action is: public JsonResult IsValidaSSN(string SSN) { //.... return Json(result, JsonRequestBehavior.AllowGet); } but always SSN is null in action, I also try MainModelSSN , MainModel_SSN but no change and always is null, what is your suggestion? what is the correct name

Custom remote validation attribute throwing error at server side in ASP.NET MVC

五迷三道 提交于 2019-12-08 12:18:52
问题 I am developing an ASP.NET MVC Web Application. In my project I am doing remote validation using data annotation to my view model class. I know default remote attribute does not support server validation. I can validate it again in action method. But I do not want to do that it is violating separation of concerns. So I tried to create custom server client remote validation attribute. I found a code online and I used it. But it is giving me error when server validation is occurred. This is my

Generic Remote Validations in MVC 5

早过忘川 提交于 2019-12-08 06:56:31
问题 I am developing an MVC 5 app using EF 6 database first approach. I have a certain validation which is required for fields in many of my models. I am using remote validation for validating them. Since it was being used in a lot of models so I am trying to go for a generic method. For that matter I made an Interface named IEntity which includes all properties being used in my models. Then I did the following for my Validation method: [HttpPost] public JsonResult UniqueCheck<T>(T code) where T :