Hi,
Could anyone provide assistance with validation.
I have Q1 (Yes/No)
Q2 - Q10 (Yes/No)
If Q1 is Yes, then at least one of Q2-10 must be yes
If Q1 is No, then all Q2-10 must be No
Can you assign Q2-10 = 0 or 1
then add-up Q2-10
If yes the Q2-20 >= 1
or No then Q2-10 = 0
How would you say this in Java????
Thanks
Clive
Lew - 12 Apr 2007 13:23 GMT
> Hi,
>
[quoted text clipped - 14 lines]
>
> How would you say this in Java????
Convert checkbox inputs to boolean (Struts does this for you). Throw the
booleans into an array or List.
boolean isQ1 = checks.get(0);
if ( isQ1 )
{
for ( int ix = 1; ix < checks.size(); ++ix )
{
if ( checks.get(ix) )
{
return VALID;
}
}
return INVALID;
}
else
{
for ( int ix = 1; ix < checks.size(); ++ix )
{
if ( checks.get(ix) )
{
return INVALID;
}
}
return VALID;
}

Signature
Lew