Yes, it is cleared in the reset method of the session-scoped bean. I'm
pretty methodical about that.  Is my syntax ok?

Ken

-----Original Message-----
From: Michael J. [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 19, 2005 4:33 PM
To: Struts Users Mailing List
Subject: Re: Using checkbox value in Validator validwhen test

It is a classic. Look on Ted Husted's website for tip. 

Basically, you need to clear checkbox value each time in the reset()
method of a form bean, because cleared value is not sent to server. So
you think that you cleared it, but it is still set (do you use
session-scoped form bean?)

Michael Jouravlev.

On 4/19/05, Dornback, Ken <[EMAIL PROTECTED]> wrote:
> Problem: I don't know how to test a checkbox setting in the validwhen
> test var-value.
> 
> I have a checkbox and a text field. I only need  to validate the text
> field when the checkbox is checked.  I cannot get this to work using
> validwhen (other validwhens do work that use different types of
tests).
> It always requires the text field value be supplied regardless of the
> checkbox setting.  The checkbox sets the options.EMailConfig.enabled
> property (The enabled field in the code does have a getter  -
> isEnabled()).  Here is the xml I've tried:
> 
>             <field  property="options.EMailConfig.primaryServer"
> depends="validwhen">
> 
>                 <arg0 key="AlertsOptions.EMAIL_PRIMARY"/>
> 
>                 <var>
> 
>                 <var-name>test</var-name>
> 
>                 <var-value>((options.EMailConfig.enabled == null) or
> (*this* != null))</var-value>
> 
>             </var>
> 
>             </field>
> 
> I've also tried !options.EMailConfig.enabled for and it also fails.
> Thanks.
> 
>

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

Reply via email to