This would be useful to indicate on the Validator portion of the Struts
User guide on the website.  I think knowing that information is an
important aspect of the email validation.

-----Original Message-----
From: Tom Ansley [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 06, 2006 8:33 AM
To: Struts Users Mailing List
Subject: Re: Validator Question

The email rule does that for you.  If you do not enter an email address
the
rule is not applied.  If you enter an email address the rule is applied
to
make sure the email is valid.

Cheers
Tom


On 2/6/06, Tom Ansley <[EMAIL PROTECTED]> wrote:
>
> The email rule does that for you.  If you do not enter an email
address
> the
> rule is not applied.  If you enter an email address the rule is
applied to
> make sure the email is valid.
>
> Cheers
> Tom
>
> -----Original Message-----
> From: Kalcevich, Daniel [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 06, 2006 8:32 AM
> To: Struts Users Mailing List
> Subject: RE: Validator Question
>
> So then how would you test a field that is not required to enter a
value
> into, but if the user does, it must be a valid email address?  That is
> what
> I am ultimately looking for.  Is there a way to achieve this using the
> validators that exist already, or do I need to create my own?
>
> Daniel
>
> -----Original Message-----
> From: Niall Pemberton [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 03, 2006 5:02 PM
> To: Struts Users Mailing List
> Subject: Re: Validator Question
>
> 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]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


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

Reply via email to