Re: Validation Problem
Re: Validation Problem
- Subject: Re: Validation Problem
- From: mmalcolm crawford <email@hidden>
- Date: Sat, 26 Apr 2003 01:58:17 -0700
On Saturday, April 26, 2003, at 12:52 AM, Jonathan Fleming wrote:
public String validatePicDescriptionTag(String newPicDescriptionTag)
throws NSValidation.ValidationException {
if ( newPicDescriptionTag == null ||
newPicDescriptionTag.equals("") ) {
throw new NSValidation.ValidationException("Your
description of this image should be no more than 255 characters
(approx. 30 - 50 words). Please amend your text.");
}
return newPicDescriptionTag;
}
I get no errors at all and the validation works, so it seams I have a
problem with this statement but I can not see it:
newPicDescriptionTag.length() > 255
(a) Your condition now tests for null values, so naturally you won't
see NullPointerExceptions...
(b) EOModel-based constraints are checked before validation methods are
called. If your model describes the picDescriptionTag attribute as
being 255 characters wide, and you enter a 256+ character wide string,
it will be rejected.
For more on validation, see:
<http://www.stepwise.com/Articles/Technical/2001-06-13.01.html>
mmalc
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.