validation

Enterprise Library Validation Block - Validate nullable properties?

I am trying to come up with a validation for a nullable property, like int? Example [RangeValidator(0, RangeBoundaryType.Inclusive, 1, RangeBoundaryType.Inclusive)] int? Age { get; set; } However if I set Age to null validation fails because it doesn't fall in the range, I know I need an [ValidatorComposition(CompositionType....

Is there a way in Java to determine if a path is valid without attempting to create a file?

I need to determine if a user-supplied String is a valid file path (i.e. if createNewFile() will succeed or throw an Exception) but i don't want to bloat the file system with useless files created just for validation purposes, so is there a way to determine if the String i have is a valid file path without attempting to create the file? ...

ValidatesOnExceptions fires but it doesn't show the exception message

Hello, I have a TextBox.TextProperty bound to a ViewModel property. In the binding I have explicitly set ValidatesOnExceptions to True. In resources the TextBox has this trigger: <Trigger Property="Validation.HasError" Value="true"> <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(...

Lazy object creation in C++, or how to do zero-cost validation

I've stumbled across this great post about validating parameters in C#, and now I wonder how to implement something similar in C++. The main thing I like about this stuff is that is does not cost anything until the first validation fails, as the Begin() function returns null, and the other functions check for this. Obviously, I can achi...

How to validate this scenario in ASP.NET MVC?

First, a little bit of context (cause I know you all love it!): I have a model called Note. It has a field called Type which, in the database, is an integer value that designates which type of object this note belongs to (1 = Customer, 2 = Sales Lead, etc). A second field called Source designates the ID of the specific object that this ...

Custom Schema Validation behaviour - XmlReaderSettings

I am parsing XML with an XMLReader using a XMLReaderSettings object with the event handling setup to carry out schema validation where appropriate. However it seems that the error catching only occurs once per level of XML. This means that any subsequent errors at that level are ignored. Is there any way I can get the Error handling ev...

Jquery Live Validation

Hello Everyone, After having a search around I could not find exactly what I want, I am looking to validate a form client side using the Jquery library and some form of validation plugin. I was hoping that some one could advise me on whether there are any validation plugins out there that do not use generic error messages, as my form ...

Has anyone build form validation using YUI?

DUPE: http://stackoverflow.com/questions/93664/any-yahoo-yui-validation-framework-that-i-can-implement-in-asp-net-mvc Has anyone built form validation functions using YUI that could mimick how asp.net handles form validation? I know jquery has a nice validation addon, was hoping YUI would also. ...

Validate each element in an array?

Hello, I am currently trying to validate a form server side, the way it works is all the data is put into and array, with the form field as the key and and the field data as the value, however I need to check that all the keys have a value associated with other wise I want the submittion to stop and the user having to edit there detail...

Comparison of .NET Validation Frameworks

I was searching for a validation framework for .NET. I saw a few, but I didn't see any comparisons. Which one do you prefer to use, and why? ...

Validating XML tag by tag

Hi All I'm having some issues validating some XML against a Schema, using .net and C#. I am using XmlReaderSettings with the ValidationEventHandler. However, this seems to stop catching errors after it has encountered the first error at a particular level within the XML file, instead of checking the next tag at the same level, so bas...

multi locale validation of input

Hi all, When validating user inputs in an application that is to be run across multiple locales, what is the most appropriate way of doing this? I encountered this in a project I was on a few years ago, and I am interested now in looking back at how else we could have tackled this problem. Ideas I have had are to either write an input ...

PHP based form validation helpers?

From my time working with Ruby On rails, there is a couple different packaged/projects out there to manage both validation and error reporting in an extensible way. Self-studying Python Pylons I just got introduced to HTMLFill which so far seems like an elegant solution to a common task of form validation. I know both examples are feat...

The jQuery Validation `valid()` method returns 0 when required is not true

I'm using the jQuery Validation plugin and I've got a textbox with the class digits to force it to be digits only, but not required. When I call validate on the form it works fine, but if I call valid() on the textbox when it's empty, it returns 0, despite no error message showing and required not being set. Does anyone know why it wou...

Can i return JsonResult from an MVC action and still take advantage of validation?

I haven't actually tried this yet and was hoping for a quick yes or no answer. I am just learning about using JSonResult from a helpful stackoverflow question. What I was wondering was can I use this kind of an actionresult, but still take advantage of the validation provided by the MVC model? If I'm returning a Json result and theres...

Force validation on bound controls in WPF

Hello. I have a WPF dialog with a couple of textboxes on it. Textboxes are bound to my business object and have WPF validation rules attached. The problem is that user can perfectly click 'OK' button and close the dialog, without actually entering the data into textboxes. Validation rules never fire, since user didn't even attempt ente...

How to detect a typo in a product search and suggest possible corrections?

Given a very large database of product names, how would you detect possible typos in user searches and suggest possible corrections (Kinda like the way Google presents them)? E.g. User enters "fork handels" and presses 'search'. They get back "No results. Did you mean 'fork handles'?" ...

Errors forming a JAXP Schema (javax.xml.validation.Schema)

We are using JAXB 2.x to generate data objects from a massive schema system (42 XSD files). That entire process runs fine, no problems there. But they deprecated (and removed from implementation) the entire JAXB validation framework, replacing it with the JAXP validation framework instead. (This is all located in the javax.xml.validation...

Spring MVC validation with Annotations

I'm having quite some trouble since I migrated my controllers from classical inheritance to use the annotations like @Controller and @RequestMapping. The problem is that I don't know how to plug in validation like in the old case. Are there any good tutorials about this? ...

jQuery UI Dialog validation without using <form> tags

http://bassistance.de/jquery-plugins/jquery-plugin-validation/ looks to be the best jquery validation plugin out there. I can't seem to get it working in the jQuery UI dialog though. This code works outside of the dialog DIV: <script type="text/javascript"> $(document).ready(function() { $("form").validate(); $("a").bind("cli...