Balazs Michnay wrote:
Dear Struts Users,

I have a form with 13 form controls on it. I'd like to use the Struts 
Validation Framework to validate it, but it's acting weird.
What I'd like to do is to have AT LEAST ONE of the controls filled, but the test of 
"validWhen" only allows simple boolean expressions.
I used a simple approach of checking each control for their value being null 
but the test cannot containmore than one boolean operator.
For instance, the following works just fine:

                <var>
                    <var-name>test</var-name>
                    <var-value> ((*this* != null) or (suly != null)) 
</var-value>
                </var>

But if I insert another control test, I get an error message saying "ValidWhen Error 
for field ' magassag' - line 1:37: expecting RPAREN, found 'or'", so no more than 
two conditions are allowed in a test.

Is that true? Is there any way to create complex tests? Or is there a way to 
validate the form for having at least one field filled?

The grammar for validwhen expressions is rather limited; you can only have one operator per group. The solution is to add additional parentheses:

  <var-value>(((*this* != null) or (suly != null)) or ...)/var-value>

L.


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

Reply via email to