You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Glenn Wilson <gx...@hotmail.com> on 2007/04/15 16:34:40 UTC

validwhen not working

Hi all, new to using validator. I have validator working on most of my 
applicaiton but having a problem doing a "validwhen". I've been using the 
examples in the "Jakarta Struts Cookbook".

Here is my question(s):

I've noticed that javascript code is generated unique to the form name. 
However, when I setup a "validwhen" for  the form no form specific 
javascript code gets generated. If I include "date" in the "depends" 
attribute I do get javascript code to do the date validation but nothing to 
deal with the validwhen?

So in my example, I have a page called Spiffs. The form name is SpiffsForm 
and I've included the <html:javascript formName="SpiffsForm" cdata="false"/> 
tag in the page. I have two date/text fields (startDate,endDate) which are 
optional however, when one is populated the other date field needs to be 
populated.

The validation.xml file reads

<form name="SpiffsForm">
<field property="spiffFilter.startDateAsString" depends="validwhen">
<arg key="spiffs.prompt.startDate" position="0"/>
      <var>
      <var-name>test</var-name>
      <var-value>((spiffFilter.endDateAsString == null) or (*this* != 
null))</var-value>
      </var>
</field>
<field property="spiffFilter.endDateAsString" depends="validwhen">
<arg key="spiffs.prompt.endDate" position="0"/>
      <var>
      <var-name>test</var-name>
      <var-value>((spiffFilter.startDateAsString == null) or (*this* != 
null))</var-value>
      </var>
</field>
</form>

I'm using Struts 1.3.5 with validator 1.3.0 on a Tomcat 5.5 instance.

Any help would be appreciated.
-Glenn

_________________________________________________________________
Mortgage rates near historic lows. Refinance $200,000 loan for as low as 
$771/month* 
https://www2.nextag.com/goto.jsp?product=100000035&url=%2fst.jsp&tm=y&search=mortgage_text_links_88_h27f8&disc=y&vers=689&s=4056&p=5117


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


Re: validwhen not working

Posted by Laurie Harper <la...@holoweb.net>.
Dave Newton wrote:
> --- Glenn Wilson <gx...@hotmail.com> wrote:
>> [client-side validwhen]
> 
> IIRC there is no client-side validation for validwhen,
> but you'd want to confirm that (although you may have
> already ;)

Dave is correct. The validwhen rule is server-side only. Just to confirm ;-)

L.


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


Re: validwhen not working

Posted by Dave Newton <ne...@yahoo.com>.
--- Glenn Wilson <gx...@hotmail.com> wrote:
> [client-side validwhen]

IIRC there is no client-side validation for validwhen,
but you'd want to confirm that (although you may have
already ;)

d.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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