remote-validation

MVC Remote Attribute Additional Fields

僤鯓⒐⒋嵵緔 提交于 2019-12-08 05:09:23
问题 The jquery remote validation is adding the prefix of the input field name (mymodel.field1) to each additional field listed in data-val-remote-additionalfields. In my additional fields I have a hidden field that is not part of the model so it has a normal name like "fieldhidden" instead of "mymodel.fieldhidden". I have confirmed this by reviewing the request object at the controller and verified that one of the query string keys is "mymodel.fieldhidden" instead of "fieldhidden" and the data is

Same Remote Validation for 2 different properties in a model

落爺英雄遲暮 提交于 2019-12-07 13:55:04
问题 I have 2 properties contractor1 and contractor2 in a model, how can I use a single remote validation for both of them [Display(Name ="Contractor 1:")] [Remote("ValidateContractor", "Contracts")] public string Cntrctr1 {get; set;} [Display(Name = "Contractor 2:")] [Remote("ValidateContractor", "Contracts")]`enter code here` public string Cntrctr2 {get; set;} Remote Validation function in the Controller public JsonResult ValidateContractor1(string Cntrctr) { var valid = Validations

Event hooks for MVC unobtrusive remote validation

核能气质少年 提交于 2019-12-07 05:58:17
问题 Is there a way to hook into MVC3 unobtrusive remote validation on the client, before data is submitted to the remote method, and after a result is returned from the remote method? I am trying to tell a remote validator to only perform validation if the submit button is clicked. The normal behavior is to validate several times, such as during keypress, blur etc. This is no good, as the validation method in question needs to call a non-idempotent operation. I need to make sure that method is

MVC Remote Attribute Additional Fields

随声附和 提交于 2019-12-06 16:47:54
The jquery remote validation is adding the prefix of the input field name (mymodel.field1) to each additional field listed in data-val-remote-additionalfields. In my additional fields I have a hidden field that is not part of the model so it has a normal name like "fieldhidden" instead of "mymodel.fieldhidden". I have confirmed this by reviewing the request object at the controller and verified that one of the query string keys is "mymodel.fieldhidden" instead of "fieldhidden" and the data is null. Pretty sure its null because jquery validation is looking for "mymodel.fieldhidden" and of

ASP.NET MVC RemoteAttribute validation not working - Action not being executed

你说的曾经没有我的故事 提交于 2019-12-06 03:28:54
问题 I've been pulling my hair out trying to figure out why ValidationController actions are not being triggered. I have settings enabled in project-wide web.config: <add key="ClientValidationEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" /> I have the following controller: [OutputCache(Location = OutputCacheLocation.None, NoStore = true)] public class ValidationController : Controller { private readonly IUserRepository userRepository; public ValidationController

Event hooks for MVC unobtrusive remote validation

爷,独闯天下 提交于 2019-12-05 10:22:03
Is there a way to hook into MVC3 unobtrusive remote validation on the client, before data is submitted to the remote method, and after a result is returned from the remote method? I am trying to tell a remote validator to only perform validation if the submit button is clicked. The normal behavior is to validate several times, such as during keypress, blur etc. This is no good, as the validation method in question needs to call a non-idempotent operation. I need to make sure that method is only invoked if the user has clicked the submit button. If I could hook into a before event, I could set

ASP.NET MVC RemoteAttribute validation not working - Action not being executed

最后都变了- 提交于 2019-12-04 08:52:06
I've been pulling my hair out trying to figure out why ValidationController actions are not being triggered. I have settings enabled in project-wide web.config: <add key="ClientValidationEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" /> I have the following controller: [OutputCache(Location = OutputCacheLocation.None, NoStore = true)] public class ValidationController : Controller { private readonly IUserRepository userRepository; public ValidationController(IUserRepository userRepository) { this.userRepository = userRepository; } public JsonResult

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

不羁的心 提交于 2019-12-04 04:32:48
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, causing the user to never be able to click it again. (IE8 does not submit the form, but the event is

Parameter Name in Remote Model Validation Action of MVC3

淺唱寂寞╮ 提交于 2019-12-03 08:36:58
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 for MainModel.SSN in action argument? You could try specifying a prefix: public Action IsValidaSSN([Bind

how to use multiple AdditionalFields in remote validation - asp.net mvc

不打扰是莪最后的温柔 提交于 2019-11-30 10:56:53
I need to validate the duplicate of FirstName, LastName and Email Address combination using remote validation in my ASP.NET MVC 4 (C#) application. The Remote Validation accepts only one AdditionalFields, which is as below: [Remote("IsUserNameAvailable", "User", AdditionalFields="LastName" )] public string FirstName{ get; set; } public string LastName{ get; set; } public string EmailAddress{ get; set; } How can i add the EmailAddress for the combination? You could separate them by comma: [Remote("IsUserNameAvailable", "User", AdditionalFields="LastName,EmailAddress" )] 来源: https:/