xval

ASP.NET MVC ValidateInput(false) stops working with xVal and [RegularExpression] DataAnnotation

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 22:31:31
I would like to intercept the "<" character in the form field by a regex validator. I will describe the problem in 3 steps: Step 1 : When I try to submit a form with a field containing the "<" character, I get the "Potentially dangerous request..." - as expected in ASP.NET. Step 2 : To avoid ASP.NET's RequestValidation, I decorate my Update method in the controller with "[ValidateInput(false)]". It works as expected - now I can post "<" character without error. Step 3 : I use xVal with DataAnnotations. For example, [Required] or [StringLength(255)] works as expected. BUT when I use:

xVal and ASP.Net MVC 2 AddModelStateErrors Problem

吃可爱长大的小学妹 提交于 2019-12-04 03:24:11
I have an application that I've been using xVal successfully on for quite some time. It was recently updated to MVC 2. I use the standard DataAnnotations attributes on my domain models, which also implement a "Validate()" method that calls the DataAnnotationsValidationRunner. If there are any errors, that method throws a RulesException. In my controllers, I use the very typical catch for RulesException catch (RulesException e) { e.AddModelStateErrors(ModelState, "err"); } All typical stuff, nearly straight from the examples, and working fine until recently (I suspect the problems started at

Reusing validation attributes in custom ViewModels

妖精的绣舞 提交于 2019-12-03 08:27:41
问题 When I started using xVal for client-side validation, I was only implementing action methods which used domain model objects as a viewmodel or embedded instances of those objects in the viewmodel. This approach works fine most of the time, but there are cases when the view needs to display and post back only a subset of the model's properties (for example when the user wants to update his password, but not the rest of his profile data). One (ugly) workaround is to have a hidden input field on

Asp.Net MVC - Change error class name

﹥>﹥吖頭↗ 提交于 2019-11-30 17:39:20
When I do field validation in Asp.Net MVC, it's generated the following error css classes : input-validation-error field-validation-error Is there a way that I can change the names of the error classes that are generated? I use xVal. Charlino I don't know about xVal but as far as the ASP.NET MVC side of things go, if you have a look at the source you'll see there are some static readonly strings that represent these values. public static readonly string ValidationInputCssClassName = "input-validation-error"; public static readonly string ValidationMessageCssClassName = "field-validation-error"

Asp.Net MVC - Change error class name

孤人 提交于 2019-11-30 01:06:05
问题 When I do field validation in Asp.Net MVC, it's generated the following error css classes : input-validation-error field-validation-error Is there a way that I can change the names of the error classes that are generated? I use xVal. 回答1: I don't know about xVal but as far as the ASP.NET MVC side of things go, if you have a look at the source you'll see there are some static readonly strings that represent these values. public static readonly string ValidationInputCssClassName = "input

How to use the jQuery Validation plugin with metadata, jQuery Forms and xVal together?

痴心易碎 提交于 2019-11-28 17:55:35
I've been doing some development using the xVal framework for .NET to link up some of the validation rules for models on the server side along with some client side validation using the jQuery Validation plugin along with the jQuery Form plugin for submitting the form. However, I'm having problems linking them all together. I'm trying to achieve following: Allow the client to perform basic validation using rules defined by calling rules("add", options") plugin for jQuery Validation (this is what xVal uses to get rules defined on the server side on the model). If the client validation succeeds,

How to use the jQuery Validation plugin with metadata, jQuery Forms and xVal together?

对着背影说爱祢 提交于 2019-11-27 20:14:31
问题 I've been doing some development using the xVal framework for .NET to link up some of the validation rules for models on the server side along with some client side validation using the jQuery Validation plugin along with the jQuery Form plugin for submitting the form. However, I'm having problems linking them all together. I'm trying to achieve following: Allow the client to perform basic validation using rules defined by calling rules("add", options") plugin for jQuery Validation (this is

Validate object based on external factors (ie. data store uniqueness)

孤街浪徒 提交于 2019-11-26 22:02:58
Description My solution has these projects: DAL = Modified Entity Framework DTO = Data Transfer objects that are able to validate themselves BL = Business Layer Services WEB = presentation Asp.net MVC application DAL, BL and WEB all reference DTO which is great. The process usually executes this way: A web request is made to the WEB WEB gets DTOs posted DTOs get automagically validated via custom ActionFilter validation errors are auto-collected (Validation is OK) WEB calls into BL providing DTOs BL calls into DAL by using DTOs (can either pass them through or just use them) DTO Validation