RE: [validator] requiredif based on a value

2003-04-04 Thread Raible, Matt

> So, you're saying that effectiveDate is requiredif state == 940?
> 

Yep.

> Try adding [0] to the end of the field* vars.
> 

That worked - thanks!  I've hacked together some client-side javascript for
this since there's not one in the validator natively - I'll try to work a
method up for equals.

Matt

> David
> 
> >Is it possible to require a field based on the value of 
> another field?  I
> >tried the following, but no dice:
> >
> >>  depends="requiredif">
> >
> >   
> >   
> > field
> > state
> >   
> >   
> > fieldTest
> > EQUAL
> >   
> >   
> > fieldValue
> > 940
> >   
> >   
> >
> >Thanks,
> >
> >Matt
> >
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> _
> Tired of spam? Get advanced junk mail protection with MSN 8. 
> http://join.msn.com/?page=features/junkmail
> 
> 
> -
> 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]



Re: [validator] requiredif based on a value

2003-04-04 Thread David Graham
So, you're saying that effectiveDate is requiredif state == 940?

Try adding [0] to the end of the field* vars.

David

Is it possible to require a field based on the value of another field?  I
tried the following, but no dice:
  
  
  
field
state
  
  
fieldTest
EQUAL
  
  
fieldValue
940
  
  
Thanks,

Matt

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


_
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail

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


RE: [VALIDATOR] requiredif ??

2003-01-31 Thread Weber, Jeremy
I had a ton of problems with required if.  I finally just ripped it out and
made my own based on it.  In the code I am using, (I am unsure its b2/b3 or
a tip build at this point) I dont see a NOTEQUAL comparison

Heres what I am using  See inline comments for explanation. 


public final static String FIELD_TEST_NULL = "NULL";
public final static String FIELD_TEST_NOTNULL = "NOTNULL";
public final static String FIELD_TEST_EQUAL = "EQUAL";


public static boolean validateJSWRequiredIf(Object bean,
 ValidatorAction va, Field
field,
 ActionErrors errors,

org.apache.commons.validator.Validator validator,
 HttpServletRequest request) {

Object form =
validator.getResource(org.apache.commons.validator.Validator.BEAN_KEY);

boolean required = false;
String value=null;

System.out.println("PROPERTY: " + field.getProperty());

if (isString(bean)) {
value = (String) bean;
} else {
value = ValidatorUtil.getValueAsString(bean,
field.getProperty());

}

System.out.println("VALUE from VsValidate: " +  value);

int i = 0;
String fieldJoin = "AND";
if
(!GenericValidator.isBlankOrNull(field.getVarValue("field-join"))) {
fieldJoin = field.getVarValue("field-join");
}
if (fieldJoin.equalsIgnoreCase("AND")) {
required = true;
}
while (!GenericValidator.isBlankOrNull(field.getVarValue("field[" +
i + "]"))) {
String dependProp = field.getVarValue("field[" + i + "]");
String dependTest = field.getVarValue("field-test[" + i + "]");
String dependTestValue = field.getVarValue("field-value[" + i +
"]");
String dependIndexed = field.getVarValue("field-indexed[" + i +
"]");

System.out.println("DEPEND PROP: " + dependProp);
System.out.println("DEPEND Test: " + dependTest);
System.out.println("DEPEND TEST VALUE: " + dependTestValue);


if (dependIndexed == null)
dependIndexed = "false";
String dependVal = null;
boolean this_required = false;
if (field.isIndexed() && dependIndexed.equalsIgnoreCase("true"))
{
String key = field.getKey();
if ((key.indexOf("[") > -1) &&
 (key.indexOf("]") > -1)) {
String ind = key.substring(0, key.indexOf(".") + 1);
dependProp = ind + dependProp;
}
}
dependVal = ValidatorUtil.getValueAsString(form, dependProp);
if (dependTest.equals(FIELD_TEST_NULL)) {
if ((dependVal != null) && (dependVal.length() > 0)) {
this_required = false;
} else {
this_required = true;
}
}
if (dependTest.equals(FIELD_TEST_NOTNULL)) {
if ((dependVal != null) && (dependVal.length() > 0)) {
this_required = true;
} else {
this_required = false;
}
}
if (dependTest.equals(FIELD_TEST_EQUAL)) {

this_required = dependTestValue.equalsIgnoreCase(dependVal);

//HAD TO ADD THIS TO DO AN EQUALS COMPARISON
String dependPropValue =
ValidatorUtil.getValueAsString(bean, dependProp);
if ( ! dependTestValue.equals( dependPropValue ) ){
   System.out.println("print here---");
   return false;
}
//END ADDTION
}


if (fieldJoin.equalsIgnoreCase("AND")) {
required = required && this_required;
} else {
required = required || this_required;
}
i++;
}
if (required) {
if ((value != null) && (value.length() > 0)) {
return true;
} else {
//errors.add(field.getKey(),
Resources.getActionError(request, va, field));

errors.add(field.getKey(),StrutsValidatorUtil.getActionError(request,va,fiel
d));
return false;
}
}
return true;
}


Jeremy Weber
[EMAIL PROTECTED]


-Original Message-
From: Wendy Smoak [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 12:41 P

RE: [VALIDATOR] requiredif ??

2003-01-30 Thread Craig R. McClanahan


On Thu, 30 Jan 2003, James Turner wrote:

> Date: Thu, 30 Jan 2003 19:06:19 -0500
> From: James Turner <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
> Subject: RE: [VALIDATOR] requiredif ??
>
> > From: Karr, David [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, January 30, 2003 6:05 PM
> > To: Struts Users Mailing List
> > Subject: RE: [VALIDATOR] requiredif ??
> >
> >
> > Gee, I haven't been paying much attention to this issue, but
> > that looks like there could be some synergy with the JSTL EL
> > engine.  You could easily handle expressions like that in the EL.
>
>
> Yes, except that Validator, which is a Commons project, would then be
> dependent on JSTL, which is a JSP-specific project.
>

A way to deal with that might be to look at commons-jexl, which implements
a superset of the JSTL EL language.  It's what Jelly uses for expression
evaluation.

> James

Craig

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




RE: [VALIDATOR] requiredif ??

2003-01-30 Thread James Turner
> From: Karr, David [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, January 30, 2003 6:05 PM
> To: Struts Users Mailing List
> Subject: RE: [VALIDATOR] requiredif ??
> 
> 
> Gee, I haven't been paying much attention to this issue, but 
> that looks like there could be some synergy with the JSTL EL 
> engine.  You could easily handle expressions like that in the EL.


Yes, except that Validator, which is a Commons project, would then be
dependent on JSTL, which is a JSP-specific project.

James



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




RE: [VALIDATOR] requiredif ??

2003-01-30 Thread Karr, David
Gee, I haven't been paying much attention to this issue, but that looks
like there could be some synergy with the JSTL EL engine.  You could
easily handle expressions like that in the EL.

-Original Message-
From: James Turner [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, January 30, 2003 11:39 AM
To: 'Struts Users Mailing List'
Subject: RE: [VALIDATOR] requiredif ??

> 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:

   test
   ((prospect == null) && (prospectNameOrId != null) &&
(action != "Add Prospect"))


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[0]
> > > prospect
> > >   
> > >   
> > > field-test[0]
> > > NULL
> > >   
> > >   
> > > field[1]
> > > prospectNameOrId
> > >   
> > >   
> > > field-test[1]
> > > NOTNULL
> > >   
> > >   
> > > field[2]
> > > action
> > >   
> > >   
> > > field-test[2]
> > > NOTEQUAL
> > >   
> > >   
> > > field-value[2]
> > > Add Prospect
> > >   
> > >   
> > > field-join
> > > AND
> > >   
> > > 
> > > 
> > > 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]


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




RE: [VALIDATOR] requiredif ??

2003-01-30 Thread Wendy Smoak
James wrote:
> Dumb question: Are you sure you're running validations at all?

Yes.  I have some simple validations like: 
   

   
and
   
 
 
   datePatternStrict
   MM/dd/
 
   
on the same form that are working fine.

>> What about the action != Add Prospect part, have I done that 
>> right?  I'm trying to compare the value of the action 
>> parameter (it's a hidden field on the form) to the literal 
>> String "Add Prospect".  (While we're at it, any chance of 
>> comparing the value to a property in the 
>> ApplicationResources.properties file?)

> That's how it's supposed to work...

Which?  Literal value, or should I be specifying a key to something in
.properties?  The example was checking something equal to "true" so I wasn't
sure.

In any event... I actually need !action.startsWith("Add"); which I don't
think is going to be possible with the Validator as-is.  It looks like you
can write your own, but I'm not familiar enough yet with how everything
works.  I ended up overriding validate()in my form, calling
super.validate(), and adding this:

if (prospect == null && "".equals(address) && !action.startsWith("Add") ) {
   if (errors == null) {
  errors = new ActionErrors();
   }
   errors.add("address", new ActionError("error.prospect.address.required")
);
}

But I still don't see a reason why what I had in the xml file would not
work.

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University PA Information Resources Management



RE: [VALIDATOR] requiredif ??

2003-01-30 Thread James Turner
> From: Wendy Smoak [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, January 30, 2003 2:44 PM
> To: 'Struts Users Mailing List'
> Subject: RE: [VALIDATOR] requiredif ??
> 
> 
> James wrote:
> > A quick look at that configuration looks correct. Let me know if it 
> > doesn't work for you.
> 
> No, it doesn't.  It's as if that rule isn't even there-- if 
> there is no prospect, and there is a prospect name, even if 
> the address is blank, it passes validation and goes to the next step.

Dumb question: Are you sure you're running validations at all?

> 
> What about the action != Add Prospect part, have I done that 
> right?  I'm trying to compare the value of the action 
> parameter (it's a hidden field on the form) to the literal 
> String "Add Prospect".  (While we're at it, any chance of 
> comparing the value to a property in the 
> ApplicationResources.properties file?)

That's how it's supposed to work...

> 
> Are all of the rules (the  tags) totally separate?  I 
> mean, there's no chance one of the other  tags is 
> affecting this one, right?

It shouldn't, unless it's the same field name.

> 
> Also, the example in the docs uses indexed properties, which 
> I have never worked with.  Am I correct that the [] square 
> brackets in my  tags only have to do with multiple 
> conditions and have nothing to do with indexed properties?

You're correct, they're for identifying separate clauses in the
condition.


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




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




RE: [VALIDATOR] requiredif ??

2003-01-30 Thread Wendy Smoak
James wrote:
> A quick look at that configuration looks correct. Let me know if it
> doesn't work for you.

No, it doesn't.  It's as if that rule isn't even there-- if there is no
prospect, and there is a prospect name, even if the address is blank, it
passes validation and goes to the next step.

What about the action != Add Prospect part, have I done that right?  I'm
trying to compare the value of the action parameter (it's a hidden field on
the form) to the literal String "Add Prospect".  (While we're at it, any
chance of comparing the value to a property in the
ApplicationResources.properties file?)

Are all of the rules (the  tags) totally separate?  I mean, there's
no chance one of the other  tags is affecting this one, right?

Also, the example in the docs uses indexed properties, which I have never
worked with.  Am I correct that the [] square brackets in my  tags only
have to do with multiple conditions and have nothing to do with indexed
properties?

Thanks!

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University PA Information Resources Management



Re: [VALIDATOR] requiredif ??

2003-01-30 Thread Matthew Meyer
Is there any reason that none of the books, or docs 
discuss writeing javascript pluggable validators. I wrote 
my own xorDependency pluggable javascript validator, one 
field or the other field required but not both. It takes 
one var named secondField that tells it the other field in 
the ValidatorForm to check.
I also wrote a andDependancy, that check to that a second 
and an optional third field are exist, if any one othe the 
three exist nice for things like optional three field 
phone numbers. Takes one var named secondField and an 
optional var thirdField.

On Thu, 30 Jan 2003 14:29:55 -0500
 "Sri Sankaran" <[EMAIL PROTECTED]> wrote:
Man, that looks convoluted.

Sri


-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[0]
> prospect
>   
>   
> field-test[0]
> NULL
>   
>   
> field[1]
> prospectNameOrId
>   
>   
> field-test[1]
> NOTNULL
>   
>   
> field[2]
> action
>   
>   
> field-test[2]
> NOTEQUAL
>   
>   
> field-value[2]
> Add Prospect
>   
>   
> field-join
> AND
>   
> 
> 
> 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]


RE: [VALIDATOR] requiredif ??

2003-01-30 Thread Sri Sankaran
I suppose that is an acceptable price to pay for being to declaratively define 
validations.

I am hoping to take advantage of requiredif to stop validator from validating upon the 
first error encountered -- of course it works only where one is testing the 'required' 
rule.

Sri

> -Original Message-
> From: James Turner [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, January 30, 2003 2:39 PM
> To: 'Struts Users Mailing List'
> Subject: RE: [VALIDATOR] requiredif ??
> 
> 
> > 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: 
>test
>((prospect == null) && (prospectNameOrId != 
> null) && (action != "Add Prospect")) 
> 
> 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[0]
> > > > prospect
> > > >   
> > > >   
> > > > field-test[0]
> > > > NULL
> > > >   
> > > >   
> > > > field[1]
> > > > prospectNameOrId
> > > >   
> > > >   
> > > > field-test[1]
> > > > NOTNULL
> > > >   
> > > >   
> > > > field[2]
> > > > action
> > > >   
> > > >   
> > > > field-test[2]
> > > > NOTEQUAL
> > > >   
> > > >   
> > > > field-value[2]
> > > > Add Prospect
> > > >   
> > > >   
> > > > field-join
> > > > AND
> > > >   
> > > > 
> > > > 
> > > > 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

RE: [VALIDATOR] requiredif ??

2003-01-30 Thread James Turner
> 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:

   test
   ((prospect == null) && (prospectNameOrId != null) &&
(action != "Add Prospect"))


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[0]
> > > prospect
> > >   
> > >   
> > > field-test[0]
> > > NULL
> > >   
> > >   
> > > field[1]
> > > prospectNameOrId
> > >   
> > >   
> > > field-test[1]
> > > NOTNULL
> > >   
> > >   
> > > field[2]
> > > action
> > >   
> > >   
> > > field-test[2]
> > > NOTEQUAL
> > >   
> > >   
> > > field-value[2]
> > > Add Prospect
> > >   
> > >   
> > > field-join
> > > AND
> > >   
> > > 
> > > 
> > > 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]




RE: [VALIDATOR] requiredif ??

2003-01-30 Thread Sri Sankaran
Man, that looks convoluted.

Sri

> -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[0]
> > prospect
> >   
> >   
> > field-test[0]
> > NULL
> >   
> >   
> > field[1]
> > prospectNameOrId
> >   
> >   
> > field-test[1]
> > NOTNULL
> >   
> >   
> > field[2]
> > action
> >   
> >   
> > field-test[2]
> > NOTEQUAL
> >   
> >   
> > field-value[2]
> > Add Prospect
> >   
> >   
> > field-join
> > AND
> >   
> > 
> > 
> > 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]




RE: [VALIDATOR] requiredif ??

2003-01-30 Thread James Turner
A quick look at that configuration looks correct. Let me know if it
doesn't work for you.

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-
> From: Wendy Smoak [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, January 30, 2003 12:41 PM
> 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[0]
> prospect
>   
>   
> field-test[0]
> NULL
>   
>   
> field[1]
> prospectNameOrId
>   
>   
> field-test[1]
> NOTNULL
>   
>   
> field[2]
> action
>   
>   
> field-test[2]
> NOTEQUAL
>   
>   
> field-value[2]
> Add Prospect
>   
>   
> field-join
> AND
>   
> 
> 
> Thanks,
> 
> -- 
> Wendy Smoak
> Applications Systems Analyst, Sr.
> Arizona State University PA Information Resources Management
> 



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




RE: [VALIDATOR] requiredif ??

2003-01-30 Thread PILGRIM, Peter, FM
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[0]
> prospect
>   
>   
> field-test[0]
> NULL
>   
>   
> field[1]
> prospectNameOrId
>   
>   
> field-test[1]
> NOTNULL
>   
>   
> field[2]
> action
>   
>   
> field-test[2]
> NOTEQUAL
>   
>   
> field-value[2]
> Add Prospect
>   
>   
> field-join
> AND
>   
> 
> 
> 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]




RE: [VALIDATOR] requiredif ??

2003-01-30 Thread Wendy Smoak

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[0]
prospect
  
  
field-test[0]
NULL
  
  
field[1]
prospectNameOrId
  
  
field-test[1]
NOTNULL
  
  
field[2]
action
  
  
field-test[2]
NOTEQUAL
  
  
field-value[2]
Add Prospect
  
  
field-join
AND
  


Thanks,

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University PA Information Resources Management



RE: Validator requiredIf

2002-12-16 Thread James Turner
Requiredif doesn't implement client-side validation, to my mind it would
be too hard to come up with a mechanism to generate Javascript for the
fairly complex cases you can generate using it.  If someone wants to
take a crack at writing it, feel free.

James

> -Original Message-
> From: Michelle Wynn [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, December 16, 2002 10:58 PM
> To: Struts Users Mailing List
> Subject: Validator requiredIf
> 
> 
> 
> Has anyone had any success validating conditionally with requiredIf
> client-side?   There does not seem to have been a javascript 
> method created
> for this validation method.   I looked in 1.1B and the most 
> recent nightly
> build.   Also haven't had success validating server side 
> (although I do
> have the source for the method in the FieldChecks class).
> 
> At a minimum can anyone point to clear documentation for 
> implementing this validation? Most of the examples I've seen 
> seem to only deal only with indexed properties/fields -- 
> which I'm not using.
> 
> Any help or insight welcomed!
> 
> Thanks,
> Michelle
> 
> 
> 
> --
> To unsubscribe, e-mail:   
>  [EMAIL PROTECTED]>
> For 
> additional commands, 
> e-mail: 
> 



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Validator requiredIf

2002-12-16 Thread Rob Leland
Michelle Wynn wrote:


Has anyone had any success validating conditionally with requiredIf
client-side?   There does not seem to have been a javascript method created
for this validation method.   I looked in 1.1B and the most recent nightly
build.   Also haven't had success validating server side (although I do
have the source for the method in the FieldChecks class).
 

Have you updated your project with the validator-rules.xml file from the 
nightly build, besides updating all the
other associated commeons-xxx.jar files?

-Rob


--
To unsubscribe, e-mail:   
For additional commands, e-mail: