> From: Sri Sankaran [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, January 30, 2003 2:30 PM
> To: Struts Users Mailing List
> Subject: RE: [VALIDATOR] requiredif ??
> 
> 
> Man, that looks convoluted.
> 
> Sri

Well, short of implementing a full boolean expression language inside
Validator, it was the best I could do.  Maybe I'll write a simple parser
for Validator 1.1 so you could say:
<var>
   <var-name>test</var-name>
   <var-value>((prospect == null) && (prospectNameOrId != null) &&
(action != "Add Prospect"))</var-value>
</var>

Of course, since requiredif is just a rule in the sample apps, anyone
else could write it too.

James Turner
Owner & Manager, Black Bear Software, LLC
[EMAIL PROTECTED]

Author: 
    MySQL & JSP Web Applications: 
        Data Driven Programming Using Tomcat and MySQL
    ISBN 0672323095; Sams, 2002

Co-Author: 
    Struts Kick Start
    ISBN 0672324725; Sams, 2002

Forthcoming:
    JavaServer Faces Kick Start 
    Sams, Fall 2003


> -----Original Message-----
> 
> > -----Original Message-----
> > From: PILGRIM, Peter, FM [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, January 30, 2003 1:03 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: [VALIDATOR] requiredif ??
> > 
> > 
> > In the Struts User Guide there is a large example with
> > indexed properties.
> > 
> > http://jakarta.apache.org/struts/userGuide/dev_validator.html
> > 
> > PS: I spend today resurrecting an old programmatical validation
> > from a previous project. 
> > --
> > Peter Pilgrim,
> > Struts/J2EE Consultant, RBoS FM, Risk IT
> > Tel: +44 (0)207-375-4923
> > 
> > 
> > > -----Original Message-----
> > > From: Wendy Smoak [mailto:[EMAIL PROTECTED]]
> > > Sent: 30 January 2003 17:41
> > > To: 'Struts Users Mailing List'
> > > Subject: RE: [VALIDATOR] requiredif ??
> > > 
> > > 
> > > 
> > > I'm Still struggling with requiredif... there doesn't 
> seem to be a 
> > > working example of it included with 1.1b3.  I've gone through the
> > > documentation and
> > > come up with this.  I'm trying to say that address is 
> > required only if
> > >   1. prospect is null
> > >   2. prospectNameOrId is not null
> > >   3. action is not equal to "Add Prospect"
> > > 
> > > <field property="address" depends="requiredif">
> > >   <arg0 key="label.prospect.address"/>
> > >   <var>
> > >     <var-name>field[0]</var-name>
> > >     <var-value>prospect</var-value>
> > >   </var>
> > >   <var>
> > >     <var-name>field-test[0]</var-name>
> > >     <var-value>NULL</var-value>
> > >   </var>
> > >   <var>
> > >     <var-name>field[1]</var-name>
> > >     <var-value>prospectNameOrId</var-value>
> > >   </var>
> > >   <var>
> > >     <var-name>field-test[1]</var-name>
> > >     <var-value>NOTNULL</var-value>
> > >   </var>
> > >   <var>
> > >     <var-name>field[2]</var-name>
> > >     <var-value>action</var-value>
> > >   </var>
> > >   <var>
> > >     <var-name>field-test[2]</var-name>
> > >     <var-value>NOTEQUAL</var-value>
> > >   </var>
> > >   <var>
> > >     <var-name>field-value[2]</var-name>
> > >     <var-value>Add Prospect</var-value>
> > >   </var>
> > >   <var>
> > >     <var-name>field-join</var-name>
> > >     <var-value>AND</var-value>
> > >   </var>
> > > </field>
> > > 
> > > Thanks,
> > > 
> > > --
> > > Wendy Smoak
> > > Applications Systems Analyst, Sr.
> > > Arizona State University PA Information Resources Management
> > > 
> > 
> > 
> > ********************************************************************
> >       Visit our Internet site at http://www.rbsmarkets.com
> > 
> > This e-mail is intended only for the addressee named above. As this 
> > e-mail may contain confidential or privileged information, 
> if you are 
> > not the named addressee, you are not authorised to retain, 
> read, copy 
> > or disseminate this message or any part of it. The Royal Bank of 
> > Scotland plc is registered in Scotland No 90312 Registered 
> Office: 36 
> > St Andrew Square, Edinburgh EH2 2YB Regulated by the Financial 
> > Services Authority
> > ********************************************************************
> > 
> > 
> ---------------------------------------------------------------------
> > 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