validation

Regex to test if an input string contains a certain number of characters

So, I basically would like to test to see if a string contains a range of alphanumeric characters. It's to be used as a client-side validation and I don't want to prevent users from entering whatever they want. Best to give examples of what should/should not pass validation: So to be specific, the expression I'm looking for is to test t...

Conditional Validation with Paperclip difficult

Hi, I have an "item", which goes through a multi-page creation process. Images are uploaded at step five, and I keep track of the steps by using the attribute "complete". When validating whether an image is attached with paperclip, I get problems using the code below: validates_attachment_presence :pic1, :if => Proc.new { |u| u.comple...

MVC: On partial page start validation from JS without postback

How do I start validation from the client/javascript using the MS MVC Validation library? Using MS ASP.Net MVC, I have a page with a PartialView in a modal dialog (change password). When the user selects 'save', I need to validate this on the client side without a full page postback. I am able in JS to post and refresh the partialVi...

Stacking :last and :checked jQuery selectors together

I'm trying to setup custom validation for a checkbox. I have 7 checkboxes each with the same name and I want to identify if the last one is checked. This is the code I have and I know its wrong, could anyone shed some light on how to properly stack the :last and :checked selectors together? $.validator.addMethod('ObserverOtherBox',funct...

How can I retrieve the instance of an attribute's associated object?

I'm writing a PropertiesMustMatch validation attribute that can take a string property name as a parameter. I'd like it to find the corresponding property by name on that object and do a basic equality comparison. What's the best way to access this through reflection? Also, I checked out the Validation application block in the Enterpr...

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...

Retain a list of objects and pass it to the create/edit view when validation fails in ASP.NET MVC 2

I am binding a Foreign key property in my model. I am passing a list of possible values for that property in my model. The model looks something like this: public class UserModel { public bool Email { get; set; } public bool Name { get; set; } public RoleModel Role { get; set; } public IList<RoleModel> Roles { get; set;...

why isn't my validator working?

hi, can anybody tell me why is the following code not working? <script type="text/javascript" src="../../Scripts/jquery.js"></script> <script type="text/javascript" src="../../Scripts/jquery.validate.js"></script> <script type="text/javascript"> $(function() { // validate contact form on keyup and submit $("#myfo...

Need to validate a scientific spreadsheet written in Java

I need a validation framework, for an app written in Java, Eclipse RCP. The UI is a simple spreadsheet with many input fields and many output fields. The user input needs to be validated, for example: Thresholds for numerical fields Required fields for certain operations Context-sensitive help based on the validation results Multi-fie...

Winform and ValidateChildren()

Probably a stupid simple question but here goes. If I have a winform app and on the Validating_Event for a container control I call ValidateChildren(). I am assumming I need a Validate_Event for each child control that I want validated, correct? I know I need the control to have Causes Validation = True but I would still need to put...

How do I use a custom XmlResolver to resolve public identifiers *inside* a DTD?

I've written a class extending XmlUrlResolver to resolve references to public identifiers in XML documents. For example, when an XML document starts with: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE chapter PUBLIC "-//Custom//EN" "custom.dtd"> The public identifier "-//Custom/EN" is passed to the relativeURI parameter of my ove...

.NET IsValidXml Extension Method Performance

I have a legacy application that I inherited that passes a lot of XML around as Strings. I often need the ability to check if a String will be valid XML. What is the fastest and least expensive way to check if a string is valid XML in .NET? I'm working in .NET 3.5 and would most likely use this as an extension method (off of string) i...

Validate JSON against a schema in .Net

I know there is a proposed standard for JSON schema validation, is there an implementation in .Net? ...

Step by Step validation with jquery validation plugin

I know its been asked many times already but no one could come up with solution so far. The idea is to have one form separated into few steps and validate each step on next click of the button. I know jquery validation plugin is offering quite complicated way of doing it with accordion but can anyone come up with a simple solution somet...

Question regarding XML validation using XSD

I am looking to create an XSD document that would validate some XML for me. Let's say, for example, that the XML documents are designed to describe books: <?xml version="1.0" encoding="UTF-8"?> <book> <comment>Bob's very first book</comment> <name>Bob's book</name> <author>Bob</author> <year>2009</year> <publisher> ...

script validation error

Hi, there is a script in my html tag <script type="text/javascript"> function setTaxDisplay(display) { window.location.href += (window.location.href.indexOf('?') > -1 ? '&' : '?') + 'taxInclude=' + display; } </script> When passed to validation It returns that the ampersand there isn't valid, but it's absolutely vital to the func...

How can I 'validate' that an XML file is correctly using the .xsd file I set for it?

I'm new to XML validation using .xsd files. Maybe I'm not even asking the correct question here; but is there a way for the computer to tell me that 'Yeah, your XML file is correctly formatted according this .xsd file you made'. I imagine I need a validator of some sort. Do those exist and it that what I need? ...

Validation is more sensible at which Level Views Level or Model level in asp.net MVC

Validation is more sensible at which Level Views Level or Model level in asp.net MVC & also link of good Tutorial on Validation in MVC ? ...

OOP Design Question - Where/When do you Validate properties?

I have read a few books on OOP DDD/PoEAA/Gang of Four and none of them seem to cover the topic of validation - it seems to be always assumed that data is valid. I gather from the answers to this post ( http://stackoverflow.com/questions/1651964/oop-design-question-validating-properties ) that a client should only attempt to set a valid ...

Date picker validation WPF

How to apply validations to WPF datepicker toolkit? I want it to error out if invalid date is selected and in some case I have Arrival and Departure dates, so I want to validate it to see that the arrival date is not later than the departure date. ...