validation

Spring: Obtaining ResourceBundle based on MessageSource

I'm using hibernate validator framework with Spring. A class implementing the Spring Validator validates objects with Hibernate's ClassValidator. To localize ClassValidator's error messages I need to pass a ResourceBundle into the class' constructor. My ApplicationCountext has a MessageSource bean (ReloadableResourceBundleMessageSource) ...

HTML Data exceeds field length after being hex-sanitized

The problem is you can't really tell the user how many characters are allowed in the field, because the escaped value, obviously, has more characters than the unescaped one. I see a few solutions, but none looks very good: One whitelist for each field (too much work and doesn't quite solve the problem) One blacklist for each field (sa...

Do you validate your websites?

I recently read a great resource by the Opera developers, entitled, "Introduction to The Web Standards Curriculum". I thought the articles put forth some good reasons why you should look at validating your website, but I realize that not everyone validates their sites, including most of the big names (Google for instance). Do you validat...

What is the best way to validate a terminal command has run successfully in Rails?

I'm writing a quick Rails app and was wondering how I can validate the success an exec'd command. The two commands I'm running are and SVN update, and a cp from one directory to another. ...

What is the best way to validate a credit card in PHP?

Given a credit card number and no additional information, what is the best way in PHP to determine whether or not it is a valid number? Right now I need something that will work with American Express, Discover, MasterCard, and Visa, but it might be helpful if it will also work with other types. ...

US Phone Number Verification

I have a website form that requires a US phone number input for follow up purposes, and this is very necessary in this case. I want try to eliminate users entering junk data 330-000-0000. I have seen some options of third parties that validate phone numbers for you, however idk if that is the best option for this situation. However if yo...

Is there a (built-in) way in JavaScript to check if a string is a valid number?

I'm hoping there's something in the same conceptual space as the old VB6 IsNumeric() function? ...

Favorite Web Form Validation Technique

What is everyone's favorite way to sanitize user data? I've been using Javascript, but have recently required something more secure (people can turn it off, after all), so I was looking at Flex, but thought I'd ask the community what they thought. ...

Do you validate your URL variables?

When you're passing variables through your site using GET requests, do you validate (regular expressions, filters, etc.) them before you use them? Say you have the URL http://www.example.com/i=45&p=custform. You know that "i" will always be an integer and "p" will always contain only letters and/or numbers. Is it worth the time to m...

How do I indicate a validation requirement to users of my class?

I'm implementing a class that wraps around an xml document with a very strictly defined schema. I don't control the schema. One of the properties in the class is for an element value that the schema indicates must match a certain regular expression. In the setter for the property, if a string doesn't match the expression I'm throwin...

How to validate a property of a custom object in a databinding scenario (i.e. BindingList)?

When you a set a property's value, you can either validate before or after updating the internal value. If validating before, you could throw an exception if the new value is invalid. The object is then always in a valid state. If validating after, undo is desired (i.e. via IEditableObject), so the user can cancel the edit any time. ...

Tool for validating SQL Server database schema

Are there any tools available for validating a database schema against a set of design rules, naming conventions, etc. I'm not talking about comparing one database to another (as covered by this question). I want to be able to say "What in this database doesn't meet this set of rules". Some examples of the type of rules I'm talking a...

Email Address Validation for ASP.NET

What do you use to validate an email address on a ASP.NET form. I want to make sure that it contains no XSS exploits. This is ASP.NET 1.1 ...

How can you validate Elements based on an attribute Value using a Schema?

The XML I'm trying to validate is as follows: <root> <element attribute="foo"> <bar/> </element> <element attribute="hello"> <world/> </element> </root> How can this be validated using a Schema? Note: element can only contain bar when attribute="foo". element can only contain world when attribute="he...

Is there any way to validate the width and height of image when uploaded?

Is there any way to validate the width and height of image when uploaded? using javascript of server side ? like jsp, aspx etc? ...

What is the best way for converting phone numbers into international format (E.164) using Java?

What is the best way for converting phone numbers into international format (E.164) using Java? Given a 'phone number' and a country id (let's say an ISO country code), I would like to convert it into a standard E.164 international format phone number. I am sure I can do it by hand quite easily - but I would not be sure it would work c...

Entity Framework Validation

I'm getting ready to start a new project and I've been researching the entity framework. My question is what is the best strategy for validating the entities? Other projects I've worked on have used attributes for most of the validation, but obviosuly this is not possible in the entity framework. Is the only way to do this by handling th...

What's the best way to validate a user-entered URL in a Cocoa application?

I am trying to build a homebrew web brower to get more proficient at Cocoa. I need a good way to validate whether the user has entered a valid URL. I have tried some regular expressions but NSString has some interesting quirks and doesn't like some of the back-quoting that most regular expressions I've seen use. ...

Validating Web Pages

I have been developing websites for a couple years now and I almost never check if my pages are valid html and css. My check is by using a site such as browsershots.org and checking how it looks in all the different browsers. However recently I have been taking a college course and the prof wants us to validate every thing we turn in. It...

XHTML and code inside textareas

On a site of mine in which a textarea is used for submission, I have code that can appear something along the lines of the following: <textarea><p>text</p></textarea> When validating (XHTML 1.0 Transitional), this error arises, line 88 column 50 - Error: document type does not allow element "p" here If this is not a valid method, t...