xval

xVal Date Validation with Nhibernate Validator

I am using xVal with NHibernate Validator and I have a hard time to validate the dates. First, NHibernate does not have validation for Date/DateTime formatting (except Past and Future). Second, I tried xVal itself (not using NHibernate Validator) but still no chance. I need to validate the date values (let's say in a text box), to mak...

Asp.Net MVC - Change error class name

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 the error class generated have a different names ? I use xVal. ...

Reusing validation attributes in custom ViewModels

Hi, 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'...

ASP.NET MVC 1.0 Validation with xVal

I'm actually fine with using another validation method. It seems there aren't many options prebuilt for doing validation with ASP.NET MVC 1.0. The main thing I see people talking about is xVal. However, there is literally no documentation for it. In fact, the blog of the founder seems to only have like two posts on it. Anyway, it's the...

Validate a bool that must be true using xVal

I have a business requirement to enforce a check box on a HTML form to be marked as true before allowing submission of the form. I can return the user to the form if this box has not been checked with an appropriate message, but want to return all information from an xVal validation of the form data at the same time. I can't find any i...

show xval RulesException using jquery in Validationsummary

I have a method which will return JsonResult or RedirectToRouteResult based on some conditions in my asp.net mvc (C#) application. The RulesException can be shown in <%= Html.ValidationSummary()%>, if i use return RedirectToAction(.....). How can i show the rules exceptions in ValidationSummary when i return it as JsonResult? ...

What's the best way of using xVal when using the Entity Framework?

What's the best way of implementing xVal when using the Entity Framework? I've been using this approach but I'd like to know if there's a better way of doing it. Also I'd like to know if there's a way of doing it without having to raise an exception. ...

ASP.NET MVC Wizard and xVal validation

Hi. I'm building a wizard-style application in ASP.NET MVC and is wondering if you have any feedback on my current approach. Each step of the wizard is a partial view (user control) wrapped by a DIV. All DIV's are shown on the same view (Create.aspx). I then use jQuery to go to next or previous step - in other words hide or show a spec...

Auto generating metadata classes for Entity Framework

I am considering using xVal for validation of Entity Framework classes in a MVC application. This involves writing metadata classes as explained in details by Graham O'Neale (http://goneale.com/2009/03/04/using-metadatatype-attribute-with-aspnet-mvc-xval-validation-framework). I am wondering if there's a way to auto generate such metad...

Can xVal be used for traditional Web forms model?

It appears that xVal fits more into a MVC model. Can it be used for traditional Web forms model? I am currently considering MS Validation block and .NET validation framework. What other validation frameworks can I look into? ...

How do I determine the source of unpredictable LINQ query results?

I've been working on an application that uses xVal's server side validation with data annotations. We recently ran into errors where the validation messages have been unpredictable for fields that have multiple validations that could fail if the field is empty (e.g., an email address is required, but also fails a validity check). Assum...

xVal Client Side validation

I am using xVal for validation in my Asp.Net MVC 1.0 project. I am running into an issue where the default DataType validation and error message is being thrown and overriding my custom RegEx error validation and message. Here is my model with the property I want to force validation on: [Required(ErrorMessage = "Year Published is re...

xVal Causing NUnit to Crash when checking ModelState.IsValid

I am trying to run a simple test on a controller in MVC. This controller validates the input using xVal and DataAnnotations. When I run the test (using NUnit via Resharper, NUnit standalone or TestDriven.Net) it crashes the runner with no decent error message. In the event logs it just has a fairly generic .NET Runtime 2.0 Error Repor...

ASP.Net MVC2 Client and Server Validation sharing the same code - is it possible?

With the excellent XVal by Steve Sanderson, it is possible to tell the client side validation to post the value being validated to the server using jquery. A method on the server then uses the same server side code you use for your server side validation, and returns simply a true or false to determine if the field is valid. The advanta...

An event for when xVal validation fails?

I have a registration form leveraging xVal to handle all validation on the form. It works really well, with one exception: the user doesn't get feedback because another element on the page (a tip telling the user that their username will be their email address) draws on top of the span element xVal spits out when it notices a problem. I...

xVal and Regular Expression Match

I am using xVal to validate my forms in asp.net MVC 1.0 Not sure why my regular expression isn't validating correctly. It does NOT validate with an empty value It does NOT validate with the value of "1", "12", "123", or "1234" It validates with the value of "12345" It validates with the value of "12345 " It validates with the value of...

xVal ignoring fields that are hidden

I have a form where a user can toggle receiving funds either via check or via electronic transfer. When they choose either way in a list box, the respective part of the form hides. If they choose electronic transfer only bank info fields show, if they choose via check only address info shows and the bank fields are hidden. Well, since ...

How can I use a custom ValidationAttribute to ensure two properties match?

We're using xVal and the standard DataAnnotationsValidationRunner described here to collect validation errors from our domain objects and view models in ASP.NET MVC. I'd like to have a way to have that validation runner identify when two properties don't match through the use of custom DataAnnotations. Right now I'm forced into doing i...

Exclude ID property from xVal validation

Can I exclude the valudation rule for the ID property? Right now I get the following validationerror message when I submit the form: The Id field is required. ...

Activate jQuery accordion section with validation errors

I am using xVal for client validation in an ASP.NET MVC application. Since I have too many fields in one of the forms, I split it into sections and used jQuery accordion to display one section at the same time. Is there a way to activate the accordion section which contains validation errors when the user clicks submit? ...