You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Bradley M. Handy" <br...@williamstonfmc.org> on 2003/06/03 19:53:39 UTC

RE: [struts-user] RE: Possible Bug in FieldChecks.validateRequiredIf(...)

You have a point.  However, the "required" check fails on all "null" and
"blank" (all whitespace) values.  Considering this, I felt this was a
"bug", because the "requiredIf" deviated from this convention.

Brad Handy


-------------------------------------------------
Bradley M. Handy		| Office: 517 750 6675
Programmer/Analyst	| Email: bhandy@arbor.edu
Spring Arbor University	|
-------------------------------------------------
Sun Certified Programmer for the Java 2 Platform
-------------------------------------------------

-----Original Message-----
From: Kruse, Matt [mailto:MKruse@aquent.com] 
Sent: Tuesday, June 03, 2003 12:03 PM
To: Struts Users Mailing List
Subject: [struts-user] RE: Possible Bug in
FieldChecks.validateRequiredIf(...)

> Am I correct in assuming that the following condition 
> "((value != null) && (value.length() > 0))" should be
> "(!GenericValidator.isBlankOrNull(value))".  The reason my check is
> failing is due to the fact the value I'm checking is all 
> white space (at certain times), and is selected from 
> a select box.

I disagree with your assumption that "     " should fail a "required"
check.
In some situations, that may be a valid value to be submitted. It
exists,
and it has a value. A validation check for the field being required
should
pass.

It sounds like what you want is a "not blank" validation, where a value
consisting of all whitespaces, tabs, or newlines would fail.

I think the two are not the same, but that's just my opinion :)

Matt Kruse


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org