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

2003-06-04 Thread Bradley M. Handy
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: [EMAIL PROTECTED]
Spring Arbor University |
-
Sun Certified Programmer for the Java 2 Platform
-

-Original Message-
From: Kruse, Matt [mailto:[EMAIL PROTECTED] 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



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

2003-06-04 Thread Bradley M. Handy
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: [EMAIL PROTECTED]
Spring Arbor University |
-
Sun Certified Programmer for the Java 2 Platform
-

-Original Message-
From: Kruse, Matt [mailto:[EMAIL PROTECTED] 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Possible Bug in FieldChecks.validateRequiredIf(...)

2003-06-04 Thread Kruse, Matt
> 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


Re: Possible Bug in FieldChecks.validateRequiredIf(...)

2003-06-04 Thread David Graham
Thanks for catching this!  Please file a bug report so we don't forget to 
fix it.

Thanks,
David
I have a validation that should be failing (under certain conditions),
but is not.  I've double checked and triple checked to make sure the
setup is correct, and it's still not working correctly.
So, I took a look at the code for "validateRequiredIf" in the
"org.apache.struts.validator.FieldChecks" class.  At the end of the
method I found this segment of code:
if (required) {
if ((value != null) && (value.length() > 0)) {
return true;
} else {
errors.add(field.getKey(), Resources.getActionError(request, va,
field));
return false;
}
}
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.
Brad Handy

-
Bradley M. Handy| Office: 517 750 6675
Programmer/Analyst  | Email: [EMAIL PROTECTED]
Spring Arbor University |
-
Sun Certified Programmer for the Java 2 Platform
-


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
Protect your PC - get McAfee.com VirusScan Online  
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Possible Bug in FieldChecks.validateRequiredIf(...)

2003-06-04 Thread Bradley M. Handy
I sent this once before, but with the wrong email account.  If this gets
posted twice, I'm sorry.



I have a validation that should be failing (under certain conditions),
but is not.  I've double checked and triple checked to make sure the
setup is correct, and it's still not working correctly.

So, I took a look at the code for "validateRequiredIf" in the
"org.apache.struts.validator.FieldChecks" class.  At the end of the
method I found this segment of code:

if (required) {
if ((value != null) && (value.length() > 0)) {
return true;
} else {
errors.add(field.getKey(), Resources.getActionError(request, va,
field));
return false;
}
}

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.

Brad Handy


-
Bradley M. Handy| Office: 517 750 6675
Programmer/Analyst  | Email: [EMAIL PROTECTED]
Spring Arbor University |
-
Sun Certified Programmer for the Java 2 Platform
-



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]