You shouldn't need to use validwhen to do what you describe - try just using
email...

<field property="notificationBcc" depends="email">
      <arg0 key="notification.pref.error.notificationbcc"/>
</field>

If however you do have reasons for using validwhen then the thing to
remember is that the "test" variable specifies the condition when the field
is valid. So what you have specified is that this field is valid when
"notificationBcc" is null - otherwise it is invalid. So any value you enter
in that field will cause a validation error. More recent versions of Struts
(from 1.2.7 I think) include a "validwhen" examples page in the
struts-examples webapp - which is included in the binary distro.

Niall

----- Original Message ----- 
From: "Kalcevich, Daniel" <[EMAIL PROTECTED]>
Sent: Friday, February 03, 2006 11:26 PM


Everyone,

I am using the validator to validate an email address in a text field.
The field is not required, but when there is a value in there, I want it
to be a valid email address.  Here is my XML,



<field property="notificationBcc" depends="validwhen,email">

      <arg0 key="notification.pref.error.notificationbcc"/>

      <var>

  <var-name>test</var-name>

        <var-value>(*this* == null)</var-value>

      </var>

</field>

But when I enter the value '[EMAIL PROTECTED]' I get an error
message saying the field is required.  Any ideas?  Thanks.

Daniel






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

Reply via email to