You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Walter do Valle <wa...@jfsc.gov.br> on 2006/10/10 20:36:17 UTC

Does validwhen has a bug?

Hello all

I'm trying to use validwhen from Struts Validator without success. I tried 
everithing it is possible, but it doesn't work. I have a radio button and a 
text field.
My validation rule is: textfield is mandatory if certain option of my radio 
is cheked. See below. In other words, if radio called tipoDivisao is "I" 
then qtPartes is mandatory.
The integer and intRange validation works perfectly. ValidWhen doesn't.
Is there something wrong? Any help is welcome.
If somebody has an example like this, please send me. 
Thanks

My JSP:

<html:radio property="tipoDivisao" styleId="tipoDivisao" value="P">
<html:radio property="tipoDivisao" styleId="tipoDivisao" value="I">
<html:text property="qtPartes" size="3" maxlength="3" styleId="qtPartes" 
disabled="true"/>

My validation.xml:

<form name="pdfForm">
  <field property="qtPartes" depends="integer,intRange,validwhen">
     <arg0 key="index.qtPartes"/>
     <arg1 name="intRange" key="${var:min}" resource="false"/>
     <arg2 name="intRange" key="${var:max}" resource="false"/>
     <var>
	<var-name>min</var-name>
	<var-value>1</var-value>
     </var>
     <var>
	<var-name>max</var-name>
	<var-value>999</var-value>
     </var>
     <var>
	<var-name>test</var-name>
	<var-value>
	  ( (tipoDivisao != "I") or (qtPartes != null) )
	</var-value>
     </var>
  </field>
...






---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Does validwhen has a bug?

Posted by Walter do Valle <wa...@jfsc.gov.br>.
Thried. Does not work.
This was my first test.

Nuwan Chandrasoma escreveu:
> try this
>
> ( (tipoDivisao != "I") or (*this* != null) )
>
> ----- Original Message ----- From: "Walter do Valle" 
> <wa...@jfsc.gov.br>
> To: <us...@struts.apache.org>
> Sent: Tuesday, October 10, 2006 6:36 PM
> Subject: Does validwhen has a bug?
>
>
>> Hello all
>>
>> I'm trying to use validwhen from Struts Validator without success. I 
>> tried everithing it is possible, but it doesn't work. I have a radio 
>> button and a text field.
>> My validation rule is: textfield is mandatory if certain option of my 
>> radio is cheked. See below. In other words, if radio called 
>> tipoDivisao is "I" then qtPartes is mandatory.
>> The integer and intRange validation works perfectly. ValidWhen doesn't.
>> Is there something wrong? Any help is welcome.
>> If somebody has an example like this, please send me. Thanks
>>
>> My JSP:
>>
>> <html:radio property="tipoDivisao" styleId="tipoDivisao" value="P">
>> <html:radio property="tipoDivisao" styleId="tipoDivisao" value="I">
>> <html:text property="qtPartes" size="3" maxlength="3" 
>> styleId="qtPartes" disabled="true"/>
>>
>> My validation.xml:
>>
>> <form name="pdfForm">
>>  <field property="qtPartes" depends="integer,intRange,validwhen">
>>     <arg0 key="index.qtPartes"/>
>>     <arg1 name="intRange" key="${var:min}" resource="false"/>
>>     <arg2 name="intRange" key="${var:max}" resource="false"/>
>>     <var>
>> <var-name>min</var-name>
>> <var-value>1</var-value>
>>     </var>
>>     <var>
>> <var-name>max</var-name>
>> <var-value>999</var-value>
>>     </var>
>>     <var>
>> <var-name>test</var-name>
>> <var-value>
>>   ( (tipoDivisao != "I") or (qtPartes != null) )
>> </var-value>
>>     </var>
>>  </field>
>> ...

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Does validwhen has a bug?

Posted by Nuwan Chandrasoma <my...@gmail.com>.
try this

( (tipoDivisao != "I") or (*this* != null) )

----- Original Message ----- 
From: "Walter do Valle" <wa...@jfsc.gov.br>
To: <us...@struts.apache.org>
Sent: Tuesday, October 10, 2006 6:36 PM
Subject: Does validwhen has a bug?


> Hello all
>
> I'm trying to use validwhen from Struts Validator without success. I tried 
> everithing it is possible, but it doesn't work. I have a radio button and 
> a text field.
> My validation rule is: textfield is mandatory if certain option of my 
> radio is cheked. See below. In other words, if radio called tipoDivisao is 
> "I" then qtPartes is mandatory.
> The integer and intRange validation works perfectly. ValidWhen doesn't.
> Is there something wrong? Any help is welcome.
> If somebody has an example like this, please send me. Thanks
>
> My JSP:
>
> <html:radio property="tipoDivisao" styleId="tipoDivisao" value="P">
> <html:radio property="tipoDivisao" styleId="tipoDivisao" value="I">
> <html:text property="qtPartes" size="3" maxlength="3" styleId="qtPartes" 
> disabled="true"/>
>
> My validation.xml:
>
> <form name="pdfForm">
>  <field property="qtPartes" depends="integer,intRange,validwhen">
>     <arg0 key="index.qtPartes"/>
>     <arg1 name="intRange" key="${var:min}" resource="false"/>
>     <arg2 name="intRange" key="${var:max}" resource="false"/>
>     <var>
> <var-name>min</var-name>
> <var-value>1</var-value>
>     </var>
>     <var>
> <var-name>max</var-name>
> <var-value>999</var-value>
>     </var>
>     <var>
> <var-name>test</var-name>
> <var-value>
>   ( (tipoDivisao != "I") or (qtPartes != null) )
> </var-value>
>     </var>
>  </field>
> ...
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org