Perform date validation only if field required (requiredIf/validWhen)

2004-02-20 Thread Ivan Jensen

Hi,

I have three radio buttons in a form,

---
o Today
o Tomorrow
o From this date: [  ] 
---

I am currently using requiredIf and date validation on the date textarea .  The date 
entry is only required if the correct radio button is selected and the date validation 
makes sure this is in the right format.  

This works fine, until the user enters an invalid date that doesn't pass date 
validation and *then* select's one of the other radio buttons, and submits.  The 
requiredIf passes fine (not required), but the date validation is still perfomed and 
returns the page to the user.

Is it possible to perform date validation only if requiredif decides the fields are 
required?  That is, don't test things that aren't required, without:
  * extra javascript in the page
  * without using custom validation java-code (the rest of the form's validation works 
great)

I have looked at validWhen (and am not aversed to going to the nightly-build), but 
can't see the solution there either.

Any help would be appreciated,

Ivan 
 


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

Problem with requiredIf validation

2003-12-17 Thread Markus
Hi,

we try to concat more than two conditions with requiredIf.
Something like (selectionOne==1 || selectionOne==2)  value ==2
The problem is that it is not clear how the validator evaluates the
expression.
Does anyone having experiences with that.


TIA,
Markus


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



requiredif validation challenge

2003-12-12 Thread Clark Kent

I use Struts 1.1 and tried to add the patch for the requiredif validator in 
validator-rules.xml.  

Following is the code that I added in the validation.xml for the form.  The form has 2 
fields and only one of them can be filled inorder to perform a search.

field property=acctID depends=requiredif, mask
arg0 key=csc.prompt.acctid/
msg name=requiredif key=errors.requiredif/
var
var-namefield[0]/var-name
var-valueuserID/var-value
/var

var
var-namefield-test[0]/var-name
var-valueNULL/var-value
/var
/field



field property=userID depends=requiredif, mask
arg0 key=csc.prompt.userid/
msg name=requiredif key=errors.requiredif/
var
var-namefield[0]/var-name
var-valueacctID/var-value
/var

var
var-namefield-test[0]/var-name
var-valueNULL/var-value
/var 
/field


It seems like inspite of the above, it still doesnt seem to validate requiredif 
validator and proceeds with the submit anyway.  Can someone guide me?

Clark


-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

RE: requiredif validation challenge

2003-12-12 Thread Udaya Allu
Hi Clark,

The following is similar validation in struts 1.1 final release working fine, for the 
case first  field is necessary when second field is null, otherwise one of the two 
shall be available. Do not bother about additional condition of page attribute of page.
It is just show how to use two fields in required if.
The error your code is in in  var-name 
change from field-test[0] to fieldTest[0] in final release of struts 1.1
can find this in struts validation doc.
Hope this will help
-Udaya 

formset   
form name=forgotForm
field property=username depends=requiredif
arg0 key=errors.usernameorpassword/
  var
var-namefield[0]/var-name
var-valuecurrentPage/var-value
  /var
  var
var-namefieldTest[0]/var-name
var-valueEQUAL/var-value
  /var  
  var
var-namefieldValue[0]/var-name
var-value1/var-value
  /var
  var
var-namefield[1]/var-name
var-valuedomain/var-value
  /var
  var
var-namefieldTest[1]/var-name
var-valueNULL/var-value
  /var
  var
var-namefieldJoin/var-name
var-valueAND/var-value
/var
/field
field property=domain depends=mask 
arg0 key=form.domainname/
msg name=mask key=errors.domain.invalid/
var
var-namemask/var-name

var-value^[a-zA-Z0-9]+([-.]*[a-zA-Z0-9])*$/var-value
/var
/field
/form
/formset

-Original Message-
From: Clark Kent [mailto:[EMAIL PROTECTED]
Sent: Friday, December 12, 2003 12:01 PM
To: Struts Users Mailing List
Subject: requiredif validation challenge



I use Struts 1.1 and tried to add the patch for the requiredif validator in 
validator-rules.xml.  

Following is the code that I added in the validation.xml for the form.  The form has 2 
fields and only one of them can be filled inorder to perform a search.

field property=acctID depends=requiredif, mask
arg0 key=csc.prompt.acctid/
msg name=requiredif key=errors.requiredif/
var
var-namefield[0]/var-name
var-valueuserID/var-value
/var

var
var-namefield-test[0]/var-name
var-valueNULL/var-value
/var
/field



field property=userID depends=requiredif, mask
arg0 key=csc.prompt.userid/
msg name=requiredif key=errors.requiredif/
var
var-namefield[0]/var-name
var-valueacctID/var-value
/var

var
var-namefield-test[0]/var-name
var-valueNULL/var-value
/var 
/field


It seems like inspite of the above, it still doesnt seem to validate requiredif 
validator and proceeds with the submit anyway.  Can someone guide me?

Clark


-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

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



RE: requiredif validation challenge

2003-12-12 Thread Clark Kent
Hi Udaya,
 
Thanks for the corrections.  
 
I have just found out that I am missing the public static boolean validateRequiredIf( 
) 
in the struts-validator.java class which should contain the java functionality to take 
care of requiredif validator.  So it seems like this patch needs to be added onto the 
class file.
 
Clark

Udaya Allu [EMAIL PROTECTED] wrote:
Hi Clark,

The following is similar validation in struts 1.1 final release working fine, for the 
case first field is necessary when second field is null, otherwise one of the two 
shall be available. Do not bother about additional condition of page attribute of page.
It is just show how to use two fields in required if.
The error your code is in in var-name 
change from field-test[0] to fieldTest[0] in final release of struts 1.1
can find this in struts validation doc.
Hope this will help
-Udaya 






field[0]
currentPage


fieldTest[0]
EQUAL


fieldValue[0]
1


field[1]
domain


fieldTest[1]
NULL


fieldJoin
AND






mask
^[a-zA-Z0-9]+([-.]*[a-zA-Z0-9])*$





-Original Message-
From: Clark Kent [mailto:[EMAIL PROTECTED]
Sent: Friday, December 12, 2003 12:01 PM
To: Struts Users Mailing List
Subject: requiredif validation challenge



I use Struts 1.1 and tried to add the patch for the requiredif validator in 
validator-rules.xml. 

Following is the code that I added in the validation.xml for the form. The form has 2 
fields and only one of them can be filled inorder to perform a search.





field[0]
userID



field-test[0]
NULL









field[0]
acctID



field-test[0]
NULL




It seems like inspite of the above, it still doesnt seem to validate requiredif 
validator and proceeds with the submit anyway. Can someone guide me?

Clark


-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

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


-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

requiredif NULL doesn't seem to work.

2003-11-22 Thread Joe Hertz
Anyone see anything wrong with this validation.xml snippet?

I have 3 fields on my login page. User Id, Email Address and PW. I want
to allow the user to enter *either* his email address or user id. (okay,
I'm not stopping him from entering both yet.

It seems my attempt to say this field is requiredif the other field is
null doesn't work at all.

Basically, I've decided that this is *not* a job for the validator
framework because it's too complex for a requiredif (which I think is
kinda sad actually. This shouldn't be that tough), but I'm still curious
why the simple case fails.

My next question: Any idea on when Struts 1.2 comes out with
requiredWhen? Apologies if this has been asked before.

-Joe 

form name=UserLoginForm
field property=userId depends=requiredif
  arg0 key=UserLogin.userId.label /
  var
var-namefield[0]/var-name
var-valueemailAddress/var-value
  /var
  var
var-namefieldTest[0]/var-name
var-valueNULL/var-value
  /var
/field
field property=emailAddress depends=requiredif
  arg0 key=UserLogin.emailAddress.label /
  var
var-namefield[0]/var-name
var-valueuserId/var-value
  /var
  var
var-namefieldTest[0]/var-name
var-valueNULL/var-value
  /var
/field
field property=password depends=required, minlength
varvar-nameminlength/var-name
 var-value5/var-value
/var
arg0 key=UserLogin.password.label /
/field
/form



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



problem using requiredif

2003-11-13 Thread newton rutgers
Can anyone tell me what's going on in here.. i want the product field has to 
have some value other then Please select one. and it should be required 
field.

Thanks,
Newt
field  property=product depends=requiredif
 			arg0 key=firstForm.product.displayname/
 var var-namefield[0]/var-name
 var-valueproduct/var-value /var
 var var-namefieldTest[0]/var-name
   	
var-valueEQUAL/var-value
  /var
 var
 var-namefieldValue[0]/var-name
 var-valuePlease select one/var-value
 /var
		 /field

_
Send a QuickGreet with MSN Messenger 
http://www.msnmessenger-download.com/tracking/cdp_games

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


Requiredif error?

2003-10-31 Thread Greg Hess








Hi All,



I get the following error when I submit my form using the requiredif:



25 Oct 2003
12:03:13,311 - ERROR org.apache.commons.validator.Validator
- reflection: null

java.lang.reflect.InvocationTargetException

 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)

 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

 at java.lang.reflect.Method.invoke(Method.java:324)

 at org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:454)

 at org.apache.commons.validator.Validator.validateField(Validator.java:544)

 at org.apache.commons.validator.Validator.validate(Validator.java:582)

 at org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:152)

 at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:942)

 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)

 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)

 at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)

 at javax.servlet.http.HttpServlet.service(HttpServlet.java:165)

 at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)

 at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:96)

 at com.caucho.http.security.SecurityFilter.doFilter(SecurityFilter.java:115)

 at com.caucho.server.http.FilterChainFilter.doFilter(FilterChainFilter.java:88)

 at com.caucho.server.http.Invocation.service(Invocation.java:315)

 at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)

 at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246)

 at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:164)

 at com.caucho.server.TcpConnection.run(TcpConnection.java:139)

 at java.lang.Thread.run(Thread.java:536)

Caused by: java.lang.NullPointerException

 at org.apache.struts.validator.FieldChecks.validateRequiredIf(FieldChecks.java:200)

 ...
23 more



My config is good:




form name=archiveRestoreForm


field


 property=archive


 depends=requiredif


 arg0
key=archiveRestoreForm.archiveFile/

 var

  var-namefield[0]/var-name

  var-valueevent/var-value

  /var

  var

  var-namefield-test[0]/var-name

  var-valueNOTNULL/var-value

  /var
 


/field

  /form



If I switch the rule to required all is well. Any help is
much appreciated.




 
  
  Greg
   Hess
  
 
 
  
  Software
  Engineer
  
 
 
  
  Wrapped
  Apps Corporation
  
 
 
  
  275 Michael Cowpland Dr.
  
 
 
  
  Suite
   201
  
 
 
  
  Ottawa, Ontario
  
 
 
  
  K2M
  2G2
  
 
 
  
  Tel:
  (613) 591 -7552
  
 
 
  
  Fax:
  (613) 591-0523
  
 
 
  
  1 (877) 388-6742
  
 
 
  
  www.wrappedapps.com
  
 
 
  
  
  
 











RE: Requiredif error?

2003-10-31 Thread Ramadoss Chinnakuzhandai
Try
 var-namefieldTest[0]/var-name
 
 
-Original Message-
From: Greg Hess [mailto:[EMAIL PROTECTED]
Sent: Saturday, October 25, 2003 12:21 PM
To: Struts
Subject: Requiredif error?


Hi All,
 
I get the following error when I submit my form using the requiredif:
 
25 Oct 2003 12:03:13,311 - ERROR org.apache.commons.validator.Validator - reflection: 
null
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at 
org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:454)
at org.apache.commons.validator.Validator.validateField(Validator.java:544)
at org.apache.commons.validator.Validator.validate(Validator.java:582)
at 
org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:152)
at 
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:942)
at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:165)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
at 
com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:96)
at 
com.caucho.http.security.SecurityFilter.doFilter(SecurityFilter.java:115)
at 
com.caucho.server.http.FilterChainFilter.doFilter(FilterChainFilter.java:88)
at com.caucho.server.http.Invocation.service(Invocation.java:315)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246)
at 
com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:164)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:536)
Caused by: java.lang.NullPointerException
at 
org.apache.struts.validator.FieldChecks.validateRequiredIf(FieldChecks.java:200)
... 23 more
 
My config is good:
 
form name=archiveRestoreForm
field
  property=archive
  depends=requiredif
  arg0 key=archiveRestoreForm.archiveFile/
var
  var-namefield[0]/var-name
  var-valueevent/var-value
  /var
  var
  var-namefield-test[0]/var-name
  var-valueNOTNULL/var-value
  /var  
/field
/form
 
If I switch the rule to required all is well. Any help is much appreciated.
 

Greg Hess

Software Engineer

Wrapped Apps Corporation

275 Michael Cowpland Dr.

Suite 201

Ottawa, Ontario

K2M 2G2

Tel: (613) 591 -7552

Fax: (613) 591-0523

1 (877) 388-6742

www.wrappedapps.com

 http://www.wrappedapps.com 
 


Re: requiredif

2003-10-28 Thread Ruben Orta Magan

- Original Message - 
From: Marc Dugger [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]


 The new validwhen validation rule, which will be included into the Struts
 release immediately after the 1.1 release...

 I am using the nightly build to develop my app and am hoping 1.2 will be
 release by the time I'm ready to deploy.  So far, validwhen is operating
as
 promised.  I haven't run into any problems, but you may search the
archives
 to view other opinions.

How I can download the nightly build version?

Thanks


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



Re: requiredif

2003-10-28 Thread Koni Roth
http://cvs.apache.org/builds/jakarta-struts/nightly/

Ruben Orta Magan wrote:

- Original Message - 
From: Marc Dugger [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]


The new validwhen validation rule, which will be included into the Struts
release immediately after the 1.1 release...


I am using the nightly build to develop my app and am hoping 1.2 will be
release by the time I'm ready to deploy.  So far, validwhen is operating
as

promised.  I haven't run into any problems, but you may search the
archives

to view other opinions.


How I can download the nightly build version?

Thanks

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

2003-10-28 Thread Greg Dunn
Since no one offered an example for requiredIf:

In this case either x_Company OR x_First_Name and x_Last_Name are required,
so x_First_Name AND x_Last_Name are requiredIf x_Company is NULL, and
company is required if either first name OR last name is null.


field
property=x_First_Name
depends=requiredif
msg name=requiredif key=errors.requiredif /
arg0 key=payment.form.firstName.prompt name=requiredif/
arg1 key=payment.form.firstName.requiredif name=requiredif/
var
var-namefield[0]/var-name
var-valuex_Company/var-value
/var
var
var-namefield-test[0]/var-name
var-valueNULL/var-value
/var
/field

field
property=x_Last_Name
depends=requiredif
msg name=requiredif key=errors.requiredif /
arg0 key=payment.form.lastName.prompt name=requiredif/
arg1 key=payment.form.lastName.requiredif name=requiredif/
var
var-namefield[0]/var-name
var-valuex_Company/var-value
/var
var
var-namefield-test[0]/var-name
var-valueNULL/var-value
/var
/field

field
property=x_Company
depends=requiredif
msg name=requiredif key=errors.requiredif /
arg0 key=payment.form.companyName.prompt name=requiredif/
arg1 key=payment.form.companyName.requiredif name=requiredif/
var
var-namefield[0]/var-name
var-valuex_First_Name/var-value
/var
var
var-namefield-test[0]/var-name
var-valueNULL/var-value
/var
var
var-namefield[1]/var-name
var-valuex_Last_Name/var-value
/var
var
var-namefield-test[1]/var-name
var-valueNULL/var-value
/var
var
var-namefield-join/var-name
var-valueOR/var-value
/var
/field



Greg

-Original Message-
From: Rhet Behler [mailto:[EMAIL PROTECTED]
Sent: Monday, October 27, 2003 5:47 PM
To: Struts Users Mailing List
Subject: requiredif


Has anyone used this in the validation.xml?

If so could I see a simple example?

If not what are you using validwhen?

thanks


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



requiredif don't execute the condition

2003-10-27 Thread Ruben Orta Magan
Hello.

I've got a problem with the requiredif condition in the struts validator.
I'm using this dtd:

http://jakarta.apache.org/commons/dtds/validator_1_0.dtd

http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd

The validation rule is:
formset
form name=icytReviForm

field
property=tituloRevista
depends=requiredif
arg0 key=icytReviForm.tituloRevista.displayname/
var
var-namefield[0]/var-name
var-valueaccion/var-value
  /var
  var
var-namefieldTest[0]/var-name
var-valueEQUAL/var-value
  /var
  var
var-namefieldValue[0]/var-name
var-valuealta/var-value
  /var
/field
/form
/formset

accion is a hidden value that it's set when i put a submit button...the form
is

html:form action=/icytReviAction onsubmit=return
validateIcytReviForm(this)

Titulo:/tdtdhtml:text property=tituloRevista size=80/
html:submit value=alta
onclick=javascript:document.forms[0].accion.value='alta';/
html:text property=accion value=alta/

/html:form

When I push the alta submit button the validator don't execute the
requiredif condition and don't validate
my form. Any suggestion about the problem?

Thanks.


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



requiredif

2003-10-27 Thread Rhet Behler
Has anyone used this in the validation.xml?

If so could I see a simple example?

If not what are you using validwhen?

thanks


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



RE: requiredif

2003-10-27 Thread Marc Dugger
My understanding is that 'requiredif' will be deprecated and the use of
'validwhen' is encouraged.

Example:

field property=emailAddress depends=validwhen
  arg0 key=userinfo.emailAddress.label/
var
  var-nametest/var-name
  var-value((sendNewsletter == null) or (*this* !=
null))/var-value
/var
  /field


 -Original Message-
 From: Rhet Behler [mailto:[EMAIL PROTECTED]
 Sent: Monday, October 27, 2003 5:47 PM
 To: Struts Users Mailing List
 Subject: requiredif


 Has anyone used this in the validation.xml?

 If so could I see a simple example?

 If not what are you using validwhen?

 thanks


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



Re: requiredif

2003-10-27 Thread Rhet Behler
validwhen isn't available in struts 1.1 is it?

have you used this or tested it?


- Original Message - 
From: Marc Dugger [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Monday, October 27, 2003 5:32 PM
Subject: RE: requiredif


 My understanding is that 'requiredif' will be deprecated and the use of
 'validwhen' is encouraged.
 
 Example:
 
 field property=emailAddress depends=validwhen
   arg0 key=userinfo.emailAddress.label/
 var
   var-nametest/var-name
   var-value((sendNewsletter == null) or (*this* !=
 null))/var-value
 /var
   /field
 
 
  -Original Message-
  From: Rhet Behler [mailto:[EMAIL PROTECTED]
  Sent: Monday, October 27, 2003 5:47 PM
  To: Struts Users Mailing List
  Subject: requiredif
 
 
  Has anyone used this in the validation.xml?
 
  If so could I see a simple example?
 
  If not what are you using validwhen?
 
  thanks
 
 
 -
 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: requiredif

2003-10-27 Thread Marc Dugger
The new validwhen validation rule, which will be included into the Struts
release immediately after the 1.1 release...

I am using the nightly build to develop my app and am hoping 1.2 will be
release by the time I'm ready to deploy.  So far, validwhen is operating as
promised.  I haven't run into any problems, but you may search the archives
to view other opinions.


 -Original Message-
 From: Rhet Behler [mailto:[EMAIL PROTECTED]
 Sent: Monday, October 27, 2003 7:17 PM
 To: Struts Users Mailing List
 Subject: Re: requiredif


 validwhen isn't available in struts 1.1 is it?

 have you used this or tested it?


 - Original Message -
 From: Marc Dugger [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Monday, October 27, 2003 5:32 PM
 Subject: RE: requiredif


  My understanding is that 'requiredif' will be deprecated and the use of
  'validwhen' is encouraged.
 
  Example:
 
  field property=emailAddress depends=validwhen
arg0 key=userinfo.emailAddress.label/
  var
var-nametest/var-name
var-value((sendNewsletter == null) or (*this* !=
  null))/var-value
  /var
/field
 
 
   -Original Message-
   From: Rhet Behler [mailto:[EMAIL PROTECTED]
   Sent: Monday, October 27, 2003 5:47 PM
   To: Struts Users Mailing List
   Subject: requiredif
  
  
   Has anyone used this in the validation.xml?
  
   If so could I see a simple example?
  
   If not what are you using validwhen?
  
   thanks
 
 
  -
  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]



requiredif validator

2003-10-15 Thread Erez Efrati
Hi,

I am using the validator 1.02 that came with Struts 1.1. 
How do I get the 'requiredif' validator to work? Or is it not included?

Thanks,


Erez



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



RE: requiredif validator

2003-10-15 Thread Erez Efrati
Oops, sorry, what I wanted to know is about 'requiredWhen'.

Erez

-Original Message-
From: Erez Efrati [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 15, 2003 11:12 AM
To: 'Struts Users Mailing List'
Subject: requiredif validator

Hi,

I am using the validator 1.02 that came with Struts 1.1. 
How do I get the 'requiredif' validator to work? Or is it not included?

Thanks,


Erez



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

2003-10-15 Thread Adam Hardy
On 10/15/2003 01:47 PM Erez Efrati wrote:
Oops, sorry, what I wanted to know is about 'requiredWhen'.

Erez

-Original Message-
From: Erez Efrati [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 15, 2003 11:12 AM
To: 'Struts Users Mailing List'
Subject: requiredif validator

Hi,

I am using the validator 1.02 that came with Struts 1.1. 
How do I get the 'requiredif' validator to work? Or is it not included?

Thanks,

requiredWhen requiredWhen?

It's not in validation-rules.xml so I'd say it's an add-on like 
validateTwoFields.

Adam

--
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


help with requiredIf validation

2003-10-10 Thread Mick Knutson
I have the following requiredIf that does not seem to actually work:

field  property=phone1
 depends=required,minlength,maxlength
arg0 key=form.phone1/
  arg1 name=maxlength key=${var:maxlength}
resource=false/
var
var-nameminlength/var-name
var-value2/var-value
/var
var
var-namemaxlength/var-name
var-value32/var-value
/var
/field
field  property=phone1type
depends=requiredif
arg0 key=form.phone1type/
var
var-namefield[0]/var-name
var-valuephone1/var-value
/var
var
var-namefieldTest[0]/var-name
var-valueNOTNULL/var-value
/var
/field

field  property=phone2
 depends=minlength,maxlength
arg0 key=form.phone1/
  arg1 name=maxlength key=${var:maxlength}
resource=false/
var
var-nameminlength/var-name
var-value2/var-value
/var
var
var-namemaxlength/var-name
var-value32/var-value
/var
/field
field  property=phone2type
depends=requiredif
arg0 key=form.phone2type/
var
var-namefield[0]/var-name
var-valuephone2/var-value
/var
var
var-namefieldTest[0]/var-name
var-valueNOTNULL/var-value
/var
/field

I have tried amking the phone reuired, and also not having the phone
required.
Here are the HTML elements. 1 is a text field, the other is a drop down:

html:text property=phone1 size=32 maxlength=32 /

then the dropdown is in a tile for re-usabilty:
html:select property='%= beanName + type %' 
html:option value= key=form.select/
html:option value=home key=form.phone.type.home /
html:option value=work key=form.phone.type.work /
html:option value=fax key=form.phone.type.fax /
html:option value=sms key=form.phone.type.sms /
html:option value=mobile key=form.phone.type.mobile /
html:option value=pager key=form.phone.type.pager /
/html:select

Is the fact that the form.select option is ?

---
Thanks
Mick Knutson

The world is a playground...Play Hard, Play Smart.
Visit  http://www.YourSoS.com to learn how our Personal Emergency Alert 
Contact System can help you Play Smart.

+00 1 (708) 570-2772 Fax
MSN: mickknutson
ICQ: 316498480
ICQ URL: http://wwp.icq.com/316498480

---

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



Problem in validation requiredif in struts 1.1 that worked fine in Struts 1.1 RC1

2003-08-17 Thread Udaya Allu

Hello Dera All,
I am resending this request as I could not ascertain whether it is delivered to user 
group or not
-Udaya

Dear All,
Validation requiredif  worked fine in my project
when using Struts 1.1 RC1
I upgraded or using now struts 1.1.
suddenly the requiredif validation is not working.
So much of my validation stopped working.
The error is as follows.
Please help me.
Thank you very much in advance.


Caused by: java.lang.NullPointerException
at 
org.apache.struts.validator.FieldChecks.validateRequiredIf(FieldChecks.java:200)
... 43 more
12:01:23,995 ERROR [Validator] reflection: null
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at 
org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:435)
at org.apache.commons.validator.Validator.validateField(Validator.java:512)

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



requiredif - Is this correct or wrong ? -Help me

2003-08-17 Thread Udaya Allu

Hello Dear All,
Please help me to find fault in hte following code 
for requiredif validation and identical(password) comparision
that worked fine in Struts 1.1 RC1 but giving
java.lang.NullPointerException with Struts 1.1 final release
at org.apache.struts.validator.FieldChecks.validateRequiredIf(FieldChecks.java:200)
Please help me.
Thanks -Udaya


form name=myaccountEmailForm
field property=newpassword depends=requiredif,identical
arg0 key=form.password.new/
arg1 key=form.password.confirm/
  var
var-namefield[0]/var-name
var-valuecurrentPage/var-value
  /var
  var
var-namefield-test[0]/var-name
var-valueEQUAL/var-value
  /var  
  var
var-namefield-value[0]/var-name
var-value2/var-value
  /var
var
var-namesecondProperty/var-name
var-valueconfirmpassword/var-value
  /var
/field
/form

 
validator name=identical
classname=com.register.utils.ValidateUtil
method=validateIdentical
methodParams=java.lang.Object,
   org.apache.commons.validator.ValidatorAction,
   org.apache.commons.validator.Field,
   org.apache.struts.action.ActionErrors,
   javax.servlet.http.HttpServletRequest   
depends=requiredif
msg=errors.identical/
validator name=requiredif
  classname=org.apache.struts.validator.FieldChecks
  method=validateRequiredIf
 methodParams=java.lang.Object,
   org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
   org.apache.struts.action.ActionErrors,
   org.apache.commons.validator.Validator,
javax.servlet.http.HttpServletRequest
  msg=errors.required
   /validator
public static boolean validateIdentical(Object bean, ValidatorAction va,
Field field, ActionErrors errors, HttpServletRequest request) {
String value = ValidatorUtil.getValueAsString(bean, field.getProperty());
String sProperty2 = field.getVarValue(secondProperty);
String value2 = ValidatorUtil.getValueAsString(bean, sProperty2);

if (!GenericValidator.isBlankOrNull(value)) {
try {
if (!value.equals(value2)) {
errors.add(field.getKey(),
Resources.getActionError(request, va, field));

return false;
}
} catch (Exception e) {
errors.add(field.getKey(),
Resources.getActionError(request, va, field));

return false;
}
}

return true;
}

Caused by: java.lang.NullPointerException
at 
org.apache.struts.validator.FieldChecks.validateRequiredIf(FieldChecks.java:200)
... 43 more
12:01:23,995 ERROR [Validator] reflection: null
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at 
org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:435)
at org.apache.commons.validator.Validator.validateField(Validator.java:512)

-
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: Problem in validation requiredif in struts 1.1 that worked fine in Struts 1.1 RC1

2003-08-17 Thread Greg Ludington
The format of the variable names changed before Struts 1.1 final.

In your validator, try replacing your var-names field-test[0] and
field-value[0] with fieldTest[0] and fieldTest[0], respectively.

You can see this format in the example at
http://jakarta.apache.org/struts/userGuide/dev_validator.html

-Greg Ludington




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



RE: Problem in validation requiredif in struts 1.1 that worked fine in Struts 1.1 RC1

2003-08-17 Thread Udaya Allu
Thank you very much, Greg Ludington
That must be the reason of failure.
But can you advise me whether the validator dtd will be automatically
upgraded/comes with Struts1.1 final or I have to change/configure it or not necessary 
to bother about it i.e there is no relation to it.
Please clarify.
Thank you very much
-Udaya Allu

-Original Message-
From: Greg Ludington [mailto:[EMAIL PROTECTED]
Sent: Sunday, August 17, 2003 11:25 AM
To: Udaya Allu; [EMAIL PROTECTED]
Subject: RE: Problem in validation requiredif in struts 1.1 that worked
fine in Struts 1.1 RC1


The format of the variable names changed before Struts 1.1 final.

In your validator, try replacing your var-names field-test[0] and
field-value[0] with fieldTest[0] and fieldTest[0], respectively.

You can see this format in the example at
http://jakarta.apache.org/struts/userGuide/dev_validator.html

-Greg Ludington




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



how to use requiredif

2003-08-14 Thread georgehill
Hi all,

I hava question about the use of required in the validation.xml file.My example is :
 field property=conPassword depends=requiredif
   arg0 key=prompt.confirm.password/
   var
 var-nametest/var-name
 var-value((newPassword != null)/var-value
   /var
 /field
Is it right? If it's wrong, please give me a right example.
Thanks a lot. :)


Re: how to use requiredif

2003-08-14 Thread George Hill
thank you. i understand it. can you tell me where can i find all the validator 
document? i have searched the struts 1.1 document, but find a little.
- Original Message - 
From: Alex Shneyderman [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Thursday, August 07, 2003 7:11 PM
Subject: RE: how to use requiredif


 field property=phone depends=requiredif
 arg0 key=venue.phone /
 var
 var-namefield[0]/var-name
 var-valuevenueId/var-value
 /var
 var
 
 var-namefield-test[0]/var-name
 var-valueEQUAL/var-value
 /var 
 var
 
 var-namefield-value[0]/var-name
 var-value0/var-value
 /var 
 /field
 
 here is an example where phone is required if venueId is EQUAL to 0.
 There are couple of other options for the kind of test just look it up
 in FiledsCheck validator.
 
  -Original Message-
  From: georgehill [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, August 06, 2003 11:35 PM
  To: [EMAIL PROTECTED]
  Subject: how to use requiredif
  
  Hi all,
  
  I hava question about the use of required in the validation.xml
 file.My
  example is :
field property=conPassword depends=requiredif
  arg0 key=prompt.confirm.password/
  var
var-nametest/var-name
var-value((newPassword != null)/var-value
  /var
/field
  Is it right? If it's wrong, please give me a right example.
  Thanks a lot. :)
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


Re: how to use requiredif

2003-08-09 Thread George Hill
I am trying to do a change password action. It has three fields, original password, 
new password and confirm new password. I want to check the confirm new password if the 
new password is not null.So i
want to use the requiredif.
thank you for you answer.

- Original Message - 
From: Kamholz, Keith (corp-staff) USX [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Thursday, August 07, 2003 9:28 PM
Subject: RE: how to use requiredif


 It looks like you're just trying to make sue that the password field is
 filled in right?  If so, all you need to use is the 'required' validation.
 Just replace requiredif with required, and get rid of the var section.  This
 will make sure a password was entered.
 Is this what you want to do?
 
 - Keith
 
 
 -Original Message-
 From: georgehill [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, August 06, 2003 11:35 PM
 To: [EMAIL PROTECTED]
 Subject: how to use requiredif
 
 
 Hi all,
  
 I hava question about the use of required in the validation.xml file.My
 example is :
   field property=conPassword depends=requiredif
 arg0 key=prompt.confirm.password/
 var
   var-nametest/var-name
   var-value((newPassword != null)/var-value
 /var
   /field
 Is it right? If it's wrong, please give me a right example.
 Thanks a lot. :)
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


RE: how to use requiredif

2003-08-08 Thread Alex Shneyderman
field property=phone depends=requiredif
arg0 key=venue.phone /
var
var-namefield[0]/var-name
var-valuevenueId/var-value
/var
var

var-namefield-test[0]/var-name
var-valueEQUAL/var-value
/var  
var

var-namefield-value[0]/var-name
var-value0/var-value
/var  
/field

here is an example where phone is required if venueId is EQUAL to 0.
There are couple of other options for the kind of test just look it up
in FiledsCheck validator.

 -Original Message-
 From: georgehill [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, August 06, 2003 11:35 PM
 To: [EMAIL PROTECTED]
 Subject: how to use requiredif
 
 Hi all,
 
 I hava question about the use of required in the validation.xml
file.My
 example is :
   field property=conPassword depends=requiredif
 arg0 key=prompt.confirm.password/
 var
   var-nametest/var-name
   var-value((newPassword != null)/var-value
 /var
   /field
 Is it right? If it's wrong, please give me a right example.
 Thanks a lot. :)



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



RE: how to use requiredif

2003-08-08 Thread Yansheng Lin
Same sentiment here.

Where is the list of complete variable properties the the var element uses to
pass to the validator?

I was so confused that field-test[0] and fieldTest[0] both seemed to be valid
properties, until I read a tutorial by James Tuner that Change was made between
Beta 1 and RC1, variable names are now camelCase rather than dashed.

It's so hard to find this kind of things if there are not on the Struts
dev-guide page.   

-Original Message-
From: George Hill [mailto:[EMAIL PROTECTED] 
Sent: August 8, 2003 12:12 AM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: Re: how to use requiredif


thank you. i understand it. can you tell me where can i find all the validator
document? i have searched the struts 1.1 document, but find a little.
- Original Message - 
From: Alex Shneyderman [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Thursday, August 07, 2003 7:11 PM
Subject: RE: how to use requiredif


 field property=phone depends=requiredif
 arg0 key=venue.phone /
 var
 var-namefield[0]/var-name
 var-valuevenueId/var-value
 /var
 var
 
 var-namefield-test[0]/var-name
 var-valueEQUAL/var-value
 /var 
 var
 
 var-namefield-value[0]/var-name
 var-value0/var-value
 /var 
 /field
 
 here is an example where phone is required if venueId is EQUAL to 0.
 There are couple of other options for the kind of test just look it up
 in FiledsCheck validator.
 
  -Original Message-
  From: georgehill [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, August 06, 2003 11:35 PM
  To: [EMAIL PROTECTED]
  Subject: how to use requiredif
  
  Hi all,
  
  I hava question about the use of required in the validation.xml
 file.My
  example is :
field property=conPassword depends=requiredif
  arg0 key=prompt.confirm.password/
  var
var-nametest/var-name
var-value((newPassword != null)/var-value
  /var
/field
  Is it right? If it's wrong, please give me a right example.
  Thanks a lot. :)
 
 
 
 -
 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: how to use requiredif

2003-08-07 Thread Kamholz, Keith (corp-staff) USX
It looks like you're just trying to make sue that the password field is
filled in right?  If so, all you need to use is the 'required' validation.
Just replace requiredif with required, and get rid of the var section.  This
will make sure a password was entered.
Is this what you want to do?

- Keith


-Original Message-
From: georgehill [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 06, 2003 11:35 PM
To: [EMAIL PROTECTED]
Subject: how to use requiredif


Hi all,
 
I hava question about the use of required in the validation.xml file.My
example is :
  field property=conPassword depends=requiredif
arg0 key=prompt.confirm.password/
var
  var-nametest/var-name
  var-value((newPassword != null)/var-value
/var
  /field
Is it right? If it's wrong, please give me a right example.
Thanks a lot. :)


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



RequiredIf Validation with nested

2003-07-22 Thread Arnason, Tamara
Hi,

I'm trying to use the requiredif validation on fields in a nested
collection and am not having any luck.

Here's the excerpt from the validation.xml
...
form name=/submitFamily_2004
  field
  property=campus indexedListProperty=alumni
depends=requiredif
arg0 key=prompt.family.campus/
var
  var-namefield[0]/var-name
  var-valuefirstname/var-value
/var
var
  var-namefieldTest[0]/var-name
  var-valueNOTNULL/var-value
/var
  /field
/form
...

The jsp shows a collection (say, 2) of alumni beans.  Each alumnus has a
textbox for entering a first name and a textbox for entering a campus.  I
want the campus to be required IF the user enters a value for the first
name.  But, nothing happens.

If I change the validation.xml so that field[0] points to a variable outside
of the nested collection then everything works fine and messages appear
saything that the firstname in the collection is required.

Is there a way to modify the xml so this will work or is the requiredif-type
validation not (yet?) implemented to work with nested collections?

Thanks for the help!
-Tamara


requiredif docs?

2003-07-22 Thread Alex Shneyderman
I am looking for requiredif validator documentation. Does anyone have
any pointers to it, preferebaly with examples?

Thanks,
Alex.


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



RE: requiredif and *this*

2003-06-29 Thread James Turner
Requiredif doesn't provide the *this* constant, alas.

Validwhen will, and should be available in 1.1.1/1.2 (whatever we call
the next release), except that I may do another rewrite before release
it, since there's been a lot of suggestions to me to base it on the
Commons EL parser rather than doing a brand new one.

James

 -Original Message-
 From: Chen, Gin [mailto:[EMAIL PROTECTED] 
 Sent: Friday, June 27, 2003 11:15 AM
 To: 'Struts Users Mailing List'
 Subject: requiredif and *this*
 
 
 The new validwhen will provide a *this*
 So that you can easily test if 2 fields are equal.
 Is this available using requiredif?
 
 I saw Raible's article regarding this but it requires 
 creating a custom validator. I'm not opposed to doing this 
 but I don't want to introduce new items for maintenance if it 
 is now available directly from Struts.
 
 Thanks,
 -Tim
 



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



requiredif and *this*

2003-06-27 Thread Chen, Gin
The new validwhen will provide a *this*
So that you can easily test if 2 fields are equal.
Is this available using requiredif?

I saw Raible's article regarding this but it requires creating a custom
validator.
I'm not opposed to doing this but I don't want to introduce new items for
maintenance if it is now available directly from Struts.

Thanks,
-Tim

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



requiredif - simple example

2003-06-26 Thread Brian McSweeney
Hi all,
 
The validator package works well for me. 
But I'm trying to use the requiredif and failing.
 
I know there has been previous discussion of this, 
but I'm trying to a simple validation based on a checkbox 
so perhaps someone could tell me where I'm going wrong.
 
For example,
 
I want to validate a creditcard, if a checkbox is checked.
 
I currently am trying to do this as follows:
 
 
  form name=myForm
  field property=creditCard
 depends=requiredif,creditCard
 
  arg0 key=myForm.creditCard/
  arg0
  name=creditCard
key=CreditCard
  resource=false
  /
  arg0
  name=requiredif
key=A Credit-Card is
  resource=false
  /
  var
var-namemyForm.checked/var-name
var-valueon/var-value
  /var
  /field
  /form
 
 
The form name is: myForm
 
The creditcard field is named creditCard
The checkbox field is named checked
 
Note that all other types of validation are working correctly for me.
 
Any help would be SO much appreciated.
Brian


Re: requiredif - simple example

2003-06-26 Thread Kevin Robair
The following worked for me. Note that in RC1, the var-name tag values
are expected to be field-test[n], not fieldTest[n] and so on

The requiredif check was removed because in 1.1RC1, requiredif would break
a javascript validator such as mask. I used custom validation instead.

field property=prop1 depends=mask!-- removed requiredif --
msg name=requiredif key=app224Form.aForm.prop1.req/
msg name=mask key=app224Form.aForm.prop1.mask/
var
   var-namemask/var-name
   var-value${4dig}/var-value
/var   
!--var
var-namefield[0]/var-name
var-valuefeeExempt/var-value
/var
var
   var-namefieldTest[0]/var-name
   var-valueEQUAL/var-value
/var
var
   var-namefieldValue[0]/var-name
var-valuetrue/var-value
/var
var
var-namefield[1]/var-name
var-valueprop1/var-value
/var
var
   var-namefieldTest[1]/var-name
   var-valueNULL/var-value
/var
--


You can also check out the Validator doc on the struts documentation. Just
expand the struts-documentation webapp that comes with your version of
struts, it is under User and Developer Guides.

-Kevin


--- Brian McSweeney [EMAIL PROTECTED] wrote:
 Hi all,
  
 The validator package works well for me. 
 But I'm trying to use the requiredif and failing.
  
 I know there has been previous discussion of this, 
 but I'm trying to a simple validation based on a checkbox 
 so perhaps someone could tell me where I'm going wrong.
  
 For example,
  
 I want to validate a creditcard, if a checkbox is checked.
  
 I currently am trying to do this as follows:
  
  
   form name=myForm
   field property=creditCard
  depends=requiredif,creditCard
  
   arg0 key=myForm.creditCard/
   arg0
   name=creditCard
 key=CreditCard
   resource=false
   /
   arg0
   name=requiredif
 key=A Credit-Card is
   resource=false
   /
   var
 var-namemyForm.checked/var-name
 var-valueon/var-value
   /var
   /field
   /form
  
  
 The form name is: myForm
  
 The creditcard field is named creditCard
 The checkbox field is named checked
  
 Note that all other types of validation are working correctly for me.
  
 Any help would be SO much appreciated.
 Brian
 


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



RE: requiredif - simple example

2003-06-26 Thread Brian McSweeney

Hi Kevin,
Thanks for the reply.

I'm a little confused by your example though.
First off - what does the ${4dig} mean?
This won't validate a checkbox, right?

Second, you have a lot of stuff commented out. 
Are these fields getting validated?

Finally, if I wanted to just test against a boolean 
being checked would I do something like the following?

field property=prop1 depends=mask
msg name=requiredif key=app224Form.aForm.prop1.req/
msg name=mask key=app224Form.aForm.prop1.mask/
var
   var-namemask/var-name
   var-value${4dig}/var-value
/var   
var
   var-namefield-checked[0]/var-name
var-valuetrue/var-value
/var

I'm quite confused! Sorry,
Thanks,
Brian




-Original Message-
From: Kevin Robair [mailto:[EMAIL PROTECTED] 
Sent: 26 June 2003 14:30
To: Struts Users Mailing List
Subject: Re: requiredif - simple example

The following worked for me. Note that in RC1, the var-name tag values
are expected to be field-test[n], not fieldTest[n] and so on

The requiredif check was removed because in 1.1RC1, requiredif would
break
a javascript validator such as mask. I used custom validation instead.

field property=prop1 depends=mask!-- removed requiredif --
msg name=requiredif key=app224Form.aForm.prop1.req/
msg name=mask key=app224Form.aForm.prop1.mask/
var
   var-namemask/var-name
   var-value${4dig}/var-value
/var   
!--var
var-namefield[0]/var-name
var-valuefeeExempt/var-value
/var
var
   var-namefieldTest[0]/var-name
   var-valueEQUAL/var-value
/var
var
   var-namefieldValue[0]/var-name
var-valuetrue/var-value
/var
var
var-namefield[1]/var-name
var-valueprop1/var-value
/var
var
   var-namefieldTest[1]/var-name
   var-valueNULL/var-value
/var
--


You can also check out the Validator doc on the struts documentation.
Just
expand the struts-documentation webapp that comes with your version of
struts, it is under User and Developer Guides.

-Kevin


--- Brian McSweeney [EMAIL PROTECTED] wrote:
 Hi all,
  
 The validator package works well for me. 
 But I'm trying to use the requiredif and failing.
  
 I know there has been previous discussion of this, 
 but I'm trying to a simple validation based on a checkbox 
 so perhaps someone could tell me where I'm going wrong.
  
 For example,
  
 I want to validate a creditcard, if a checkbox is checked.
  
 I currently am trying to do this as follows:
  
  
   form name=myForm
   field property=creditCard
  depends=requiredif,creditCard
  
   arg0 key=myForm.creditCard/
   arg0
   name=creditCard
 key=CreditCard
   resource=false
   /
   arg0
   name=requiredif
 key=A Credit-Card is
   resource=false
   /
   var
 var-namemyForm.checked/var-name
 var-valueon/var-value
   /var
   /field
   /form
  
  
 The form name is: myForm
  
 The creditcard field is named creditCard
 The checkbox field is named checked
  
 Note that all other types of validation are working correctly for me.
  
 Any help would be SO much appreciated.
 Brian
 


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



validator requiredif boolean values

2003-06-26 Thread Wilson Chuei
Hi,

Can somebody pls tell me why the following validation is not firing?
(see xml snippet below)

contact.phoneBHVisible and contact.phoneBHRequired are booleans.

Essentially, what I want to do is that validate only when
contact.phoneBHVisible == true  contact.phoneBHRequired == true


Other fields on the same form are being validating correctly.  No observable
errors from the tomcat's stdout.

(I am using struts-1.1-rc2)

On another note, is it possible to patch 1.1-rc2 with the validwhen
valdator?

TIA,

w.

field property=contact.phoneBHPrefix depends=requiredif,mask,minlength
arg0 key=label.contact.phoneBHPrefix/
arg1 name=minlength key=${var:minlength} resource=false/
var
var-namefield[0]/var-name
var-valuecontact.phoneBHVisible/var-value
/var
var
var-namefieldTest[0]/var-name
var-valueEQUAL/var-value
/var
var
var-namefieldValue[0]/var-name
var-valuetrue/var-value
/var
var
var-namefield[1]/var-name
var-valuecontact.phoneBHRequired/var-value
/var
var
var-namefieldTest[1]/var-name
var-valueEQUAL/var-value
/var
var
var-namefieldValue[1]/var-name
var-valuetrue/var-value
/var
var
var-namefieldJoin/var-name
var-valueAND/var-value
/var
var
var-namemask/var-name
var-value^[0-9]*$/var-value
/var
var
var-nameminlength/var-name
var-value2/var-value
/var
/field


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



requiredif question

2003-06-25 Thread Mick Knutson
I have the following code that does not seem to operate at all.

I want phone1type to be a required field _if_ the phone1 attribute is _not_ 


   field  property=phone1type
   depends=requiredif
   arg0 key=form.phone1type/
   var
   var-namefield[0]/var-name
   var-valuephone1/var-value
   /var
   var
   var-namefieldTest[0]/var-name
   var-valueNOTNULL/var-value
   /var
   var
   var-namefield[1]/var-name
   var-valuephone1/var-value
 /var
 var
   var-namefieldTest[1]/var-name
   var-valueNOTEQUAL/var-value
 /var
 var
   var-namefieldValue[1]/var-name
   var-value /var-value
 /var
 var
   var-namefieldJoin/var-name
   var-valueOR/var-value
   /var
   /field


---
Thanks...
Mick Knutson
---
_
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: requiredif question

2003-06-25 Thread David Graham
--- Mick Knutson [EMAIL PROTECTED] wrote:
 I have the following code that does not seem to operate at all.
 
 I want phone1type to be a required field _if_ the phone1 attribute is
 _not_ 
 
 
 field  property=phone1type
 depends=requiredif
 arg0 key=form.phone1type/
 var
 var-namefield[0]/var-name
 var-valuephone1/var-value
 /var
 var
 var-namefieldTest[0]/var-name
 var-valueNOTNULL/var-value
 /var
 var
 var-namefield[1]/var-name
 var-valuephone1/var-value
   /var
   var
 var-namefieldTest[1]/var-name
 var-valueNOTEQUAL/var-value
   /var
   var
 var-namefieldValue[1]/var-name
 var-value /var-value

You can't define empty values in XML like that because the parser removes
the whitespace.  I'm not quite how to accomplish this though.

David


   /var
   var
 var-namefieldJoin/var-name
 var-valueOR/var-value
 /var
 /field
 
 
 
 
 ---
 Thanks...
 Mick Knutson
 ---
 
 _
 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]
 


__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



Re: requiredif question

2003-06-25 Thread Kevin Robair
Just a hunch:

For Struts 1.1RC1 , the varnames should be:

field-test[x]
field-join
etc...

In 1.1RC2, they are

fieldTest[n]
fieldJoin  
etc

BTW, I am unsure what you mean by:

  does not seem to operate at all

Are there any errors or exceptions in the log? If the form validates no
matter what you enter, and there are no errors in the log, then it is
possibly a configuration problem. You could try a simpler validation, in
place of this one just to make sure it is doing something. Then, remove
the NOTNULL check, and see if the NOTEQUAL alone works.

-Kevin

--- Mick Knutson [EMAIL PROTECTED] wrote:
 I have the following code that does not seem to operate at all.
 
 I want phone1type to be a required field _if_ the phone1 attribute is
 _not_ 
 
 
 field  property=phone1type
 depends=requiredif
 arg0 key=form.phone1type/
 var
 var-namefield[0]/var-name
 var-valuephone1/var-value
 /var
 var
 var-namefieldTest[0]/var-name
 var-valueNOTNULL/var-value
 /var
 var
 var-namefield[1]/var-name
 var-valuephone1/var-value
   /var
   var
 var-namefieldTest[1]/var-name
 var-valueNOTEQUAL/var-value
   /var
   var
 var-namefieldValue[1]/var-name
 var-value /var-value
   /var
   var
 var-namefieldJoin/var-name
 var-valueOR/var-value
 /var
 /field
 
 
 
 
 ---
 Thanks...
 Mick Knutson
 ---
 
 _
 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: requiredif question

2003-06-25 Thread Mick Knutson
Yes, no matter what I enter, nothing happends at all. It just accepts 
whatever I enter, or leave blank, and submits just fine.



---
Thanks...
Mick Knutson
---




From: Kevin Robair [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Re: requiredif question
Date: Wed, 25 Jun 2003 10:20:35 -0700 (PDT)
Just a hunch:

For Struts 1.1RC1 , the varnames should be:

field-test[x]
field-join
etc...
In 1.1RC2, they are

fieldTest[n]
fieldJoin
etc
BTW, I am unsure what you mean by:

  does not seem to operate at all

Are there any errors or exceptions in the log? If the form validates no
matter what you enter, and there are no errors in the log, then it is
possibly a configuration problem. You could try a simpler validation, in
place of this one just to make sure it is doing something. Then, remove
the NOTNULL check, and see if the NOTEQUAL alone works.
-Kevin

--- Mick Knutson [EMAIL PROTECTED] wrote:
 I have the following code that does not seem to operate at all.

 I want phone1type to be a required field _if_ the phone1 attribute is
 _not_
 

 field  property=phone1type
 depends=requiredif
 arg0 key=form.phone1type/
 var
 var-namefield[0]/var-name
 var-valuephone1/var-value
 /var
 var
 var-namefieldTest[0]/var-name
 var-valueNOTNULL/var-value
 /var
 var
 var-namefield[1]/var-name
 var-valuephone1/var-value
   /var
   var
 var-namefieldTest[1]/var-name
 var-valueNOTEQUAL/var-value
   /var
   var
 var-namefieldValue[1]/var-name
 var-value /var-value
   /var
   var
 var-namefieldJoin/var-name
 var-valueOR/var-value
 /var
 /field




 ---
 Thanks...
 Mick Knutson
 ---

 _
 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]
_
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: requiredif question

2003-06-25 Thread Kamholz, Keith (corp-staff) USX
I'm having a similar problem.  All I'm trying to do is have a 'required'
condition for 2 fields of my form.  Mine submits just fine when I leave it
blank as well.  I posted my code here yesterday, but nobody was able to help
me.  If you figure this out, I'd appreciate it if you let me know what the
problem is.  I'll do the same!

- Keith


-Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 25, 2003 1:26 PM
To: [EMAIL PROTECTED]
Subject: Re: requiredif question


Yes, no matter what I enter, nothing happends at all. It just accepts 
whatever I enter, or leave blank, and submits just fine.



---
Thanks...
Mick Knutson
---





From: Kevin Robair [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Re: requiredif question
Date: Wed, 25 Jun 2003 10:20:35 -0700 (PDT)

Just a hunch:

For Struts 1.1RC1 , the varnames should be:

field-test[x]
field-join
etc...

In 1.1RC2, they are

fieldTest[n]
fieldJoin
etc

BTW, I am unsure what you mean by:

   does not seem to operate at all

Are there any errors or exceptions in the log? If the form validates no
matter what you enter, and there are no errors in the log, then it is
possibly a configuration problem. You could try a simpler validation, in
place of this one just to make sure it is doing something. Then, remove
the NOTNULL check, and see if the NOTEQUAL alone works.

-Kevin

--- Mick Knutson [EMAIL PROTECTED] wrote:
  I have the following code that does not seem to operate at all.
 
  I want phone1type to be a required field _if_ the phone1 attribute is
  _not_
  
 
  field  property=phone1type
  depends=requiredif
  arg0 key=form.phone1type/
  var
  var-namefield[0]/var-name
  var-valuephone1/var-value
  /var
  var
  var-namefieldTest[0]/var-name
  var-valueNOTNULL/var-value
  /var
  var
  var-namefield[1]/var-name
  var-valuephone1/var-value
/var
var
  var-namefieldTest[1]/var-name
  var-valueNOTEQUAL/var-value
/var
var
  var-namefieldValue[1]/var-name
  var-value /var-value
/var
var
  var-namefieldJoin/var-name
  var-valueOR/var-value
  /var
  /field
 
 
 
 
  ---
  Thanks...
  Mick Knutson
  ---
 
  _
  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]


_
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: requiredif question

2003-06-25 Thread Mick Knutson
I did not see yours. Can you post your code again?



---
Thanks...
Mick Knutson
---




From: Kamholz, Keith   (corp-staff) USX [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Subject: RE: requiredif question
Date: Wed, 25 Jun 2003 13:26:48 -0400
I'm having a similar problem.  All I'm trying to do is have a 'required'
condition for 2 fields of my form.  Mine submits just fine when I leave it
blank as well.  I posted my code here yesterday, but nobody was able to 
help
me.  If you figure this out, I'd appreciate it if you let me know what the
problem is.  I'll do the same!

- Keith

-Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 25, 2003 1:26 PM
To: [EMAIL PROTECTED]
Subject: Re: requiredif question
Yes, no matter what I enter, nothing happends at all. It just accepts
whatever I enter, or leave blank, and submits just fine.


---
Thanks...
Mick Knutson
---




From: Kevin Robair [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Re: requiredif question
Date: Wed, 25 Jun 2003 10:20:35 -0700 (PDT)

Just a hunch:

For Struts 1.1RC1 , the varnames should be:

field-test[x]
field-join
etc...

In 1.1RC2, they are

fieldTest[n]
fieldJoin
etc

BTW, I am unsure what you mean by:

   does not seem to operate at all

Are there any errors or exceptions in the log? If the form validates no
matter what you enter, and there are no errors in the log, then it is
possibly a configuration problem. You could try a simpler validation, in
place of this one just to make sure it is doing something. Then, remove
the NOTNULL check, and see if the NOTEQUAL alone works.

-Kevin

--- Mick Knutson [EMAIL PROTECTED] wrote:
  I have the following code that does not seem to operate at all.
 
  I want phone1type to be a required field _if_ the phone1 attribute is
  _not_
  
 
  field  property=phone1type
  depends=requiredif
  arg0 key=form.phone1type/
  var
  var-namefield[0]/var-name
  var-valuephone1/var-value
  /var
  var
  var-namefieldTest[0]/var-name
  var-valueNOTNULL/var-value
  /var
  var
  var-namefield[1]/var-name
  var-valuephone1/var-value
/var
var
  var-namefieldTest[1]/var-name
  var-valueNOTEQUAL/var-value
/var
var
  var-namefieldValue[1]/var-name
  var-value /var-value
/var
var
  var-namefieldJoin/var-name
  var-valueOR/var-value
  /var
  /field
 
 
 
 
  ---
  Thanks...
  Mick Knutson
  ---
 
  _
  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]

_
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]
_
Add photos to your messages with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail

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


RE: requiredif question

2003-06-25 Thread Kamholz, Keith (corp-staff) USX
Here's my struts-config and my validation.xml.  I've also attached them, if
it's easier to look at that way.  I've only shown parts of my
struts-config.xml, enough to show one example action that isn't validating
right.
___

Struts-Config snippets:

form-beans
form-bean name=ansm type=com.moog.us.app.ans.data.AnsmItem/
form-bean name=ansa type=com.moog.us.app.ans.data.AnsaItem/
/form-beans

action path=/AddFormat type=com.moog.us.app.ans.action.AddANSM
validate=true
name=ansm
scope=request
input=tiles.addFormat/

controller processorClass=com.moog.us.struts.AppRequestProcessor /

message-resources parameter=ApplicationResources/

plug-in className=com.moog.us.struts.AppStartupPlugin/
plug-in className=org.apache.struts.tiles.TilesPlugin 
set-property property=definitions-config 
 value=/WEB-INF/tiles-defs.xml /
set-property property=moduleAware value=true /
set-property property=definitions-parser-validate value=true /
/plug-in
plug-in className=org.apache.struts.validator.ValidatorPlugIn
set-property
property=pathnames
value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/
/plug-in

___

Validation.xml:

?xml version=1.0 encoding=ISO-8859-1 ?

!DOCTYPE form-validation PUBLIC
  -//Apache Software Foundation//DTD Commons Validator Rules
Configuration 1.0//EN
  http://jakarta.apache.org/commons/dtds/validator_1_0.dtd;

form-validation

global
/global

formset
form name=ansm
field  property=numberType
depends=required
arg0 key=app.label.numberType/
/field
field  property=typeDesc
depends=required
arg0 key=app.label.numberType/
/field
/form
/formset

/form-validation




If I should send any other files, let me know.
Any input would be great, thanks!


- Keith







-Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 25, 2003 1:32 PM
To: [EMAIL PROTECTED]
Subject: RE: requiredif question


I did not see yours. Can you post your code again?



---
Thanks...
Mick Knutson
---





From: Kamholz, Keith   (corp-staff) USX [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Subject: RE: requiredif question
Date: Wed, 25 Jun 2003 13:26:48 -0400

I'm having a similar problem.  All I'm trying to do is have a 'required'
condition for 2 fields of my form.  Mine submits just fine when I leave it
blank as well.  I posted my code here yesterday, but nobody was able to 
help
me.  If you figure this out, I'd appreciate it if you let me know what the
problem is.  I'll do the same!

- Keith


-Original Message-
From: Mick Knutson [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 25, 2003 1:26 PM
To: [EMAIL PROTECTED]
Subject: Re: requiredif question


Yes, no matter what I enter, nothing happends at all. It just accepts
whatever I enter, or leave blank, and submits just fine.



---
Thanks...
Mick Knutson
---





 From: Kevin Robair [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Subject: Re: requiredif question
 Date: Wed, 25 Jun 2003 10:20:35 -0700 (PDT)
 
 Just a hunch:
 
 For Struts 1.1RC1 , the varnames should be:
 
 field-test[x]
 field-join
 etc...
 
 In 1.1RC2, they are
 
 fieldTest[n]
 fieldJoin
 etc
 
 BTW, I am unsure what you mean by:
 
does not seem to operate at all
 
 Are there any errors or exceptions in the log? If the form validates no
 matter what you enter, and there are no errors in the log, then it is
 possibly a configuration problem. You could try a simpler validation, in
 place of this one just to make sure it is doing something. Then, remove
 the NOTNULL check, and see if the NOTEQUAL alone works.
 
 -Kevin
 
 --- Mick Knutson [EMAIL PROTECTED] wrote:
   I have the following code that does not seem to operate at all.
  
   I want phone1type to be a required field _if_ the phone1 attribute is
   _not_
   
  
   field  property=phone1type
   depends=requiredif
   arg0 key=form.phone1type/
   var
   var-namefield[0]/var-name
   var-valuephone1/var-value
   /var
   var
   var-namefieldTest[0]/var-name
   var-valueNOTNULL/var-value
   /var
   var
   var-namefield[1]/var-name
   var-valuephone1/var-value
 /var
 var
   var-namefieldTest[1]/var-name

Where do I find all the potential options for requiredif validation?

2003-06-25 Thread Mick Knutson
The FA only shows a few of the options. Is there a NULL, NOTEQUALS etc
Where can I find the list of options?
---
Thanks...
Mick Knutson
---
_
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus

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


RE: requiredif question

2003-06-25 Thread Sandeep Takhar
Are you extending ValidatorForm?

sandeep
--- Kamholz, Keith   (corp-staff) USX
[EMAIL PROTECTED] wrote:
 Here's my struts-config and my validation.xml.  I've
 also attached them, if
 it's easier to look at that way.  I've only shown
 parts of my
 struts-config.xml, enough to show one example action
 that isn't validating
 right.
 ___
 
 Struts-Config snippets:
 
 form-beans
   form-bean name=ansm
 type=com.moog.us.app.ans.data.AnsmItem/
   form-bean name=ansa
 type=com.moog.us.app.ans.data.AnsaItem/
 /form-beans
 
 action path=/AddFormat
 type=com.moog.us.app.ans.action.AddANSM
   validate=true
   name=ansm
   scope=request
   input=tiles.addFormat/
 
 controller

processorClass=com.moog.us.struts.AppRequestProcessor
 /
 
 message-resources
 parameter=ApplicationResources/
 
 plug-in
 className=com.moog.us.struts.AppStartupPlugin/
 plug-in
 className=org.apache.struts.tiles.TilesPlugin 
 set-property property=definitions-config 
value=/WEB-INF/tiles-defs.xml /
 set-property property=moduleAware
 value=true /
   set-property
 property=definitions-parser-validate value=true
 /
 /plug-in
 plug-in

className=org.apache.struts.validator.ValidatorPlugIn
   set-property
 property=pathnames


value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/
 /plug-in
 
 ___
 
 Validation.xml:
 
 ?xml version=1.0 encoding=ISO-8859-1 ?
 
 !DOCTYPE form-validation PUBLIC
   -//Apache Software Foundation//DTD
 Commons Validator Rules
 Configuration 1.0//EN
  

http://jakarta.apache.org/commons/dtds/validator_1_0.dtd;
 
 form-validation
 
 global
 /global
 
   formset
   form name=ansm
   field  property=numberType
   depends=required
   arg0 key=app.label.numberType/
   /field
   field  property=typeDesc
   depends=required
   arg0 key=app.label.numberType/
   /field
   /form
   /formset
 
 /form-validation
 
 
 
 
 If I should send any other files, let me know.
 Any input would be great, thanks!
 
 
 - Keith
 
 
 
 
 
 
 
 -Original Message-
 From: Mick Knutson [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 25, 2003 1:32 PM
 To: [EMAIL PROTECTED]
 Subject: RE: requiredif question
 
 
 I did not see yours. Can you post your code again?
 
 
 
 ---
 Thanks...
 Mick Knutson
 ---
 
 
 
 
 
 From: Kamholz, Keith   (corp-staff) USX
 [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List
 [EMAIL PROTECTED]
 To: 'Struts Users Mailing List'
 [EMAIL PROTECTED]
 Subject: RE: requiredif question
 Date: Wed, 25 Jun 2003 13:26:48 -0400
 
 I'm having a similar problem.  All I'm trying to do
 is have a 'required'
 condition for 2 fields of my form.  Mine submits
 just fine when I leave it
 blank as well.  I posted my code here yesterday,
 but nobody was able to 
 help
 me.  If you figure this out, I'd appreciate it if
 you let me know what the
 problem is.  I'll do the same!
 
 - Keith
 
 
 -Original Message-
 From: Mick Knutson [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 25, 2003 1:26 PM
 To: [EMAIL PROTECTED]
 Subject: Re: requiredif question
 
 
 Yes, no matter what I enter, nothing happends at
 all. It just accepts
 whatever I enter, or leave blank, and submits just
 fine.
 
 
 
 ---
 Thanks...
 Mick Knutson
 ---
 
 
 
 
 
  From: Kevin Robair [EMAIL PROTECTED]
  Reply-To: Struts Users Mailing List
 [EMAIL PROTECTED]
  To: Struts Users Mailing List
 [EMAIL PROTECTED]
  Subject: Re: requiredif question
  Date: Wed, 25 Jun 2003 10:20:35 -0700 (PDT)
  
  Just a hunch:
  
  For Struts 1.1RC1 , the varnames should be:
  
  field-test[x]
  field-join
  etc...
  
  In 1.1RC2, they are
  
  fieldTest[n]
  fieldJoin
  etc
  
  BTW, I am unsure what you mean by:
  
 does not seem to operate at all
  
  Are there any errors or exceptions in the log? If
 the form validates no
  matter what you enter, and there are no errors in
 the log, then it is
  possibly a configuration problem. You could try a
 simpler validation, in
  place of this one just to make sure it is doing
 something. Then, remove
  the NOTNULL check, and see if the NOTEQUAL alone
 works.
  
  -Kevin
  
  --- Mick Knutson [EMAIL PROTECTED] wrote:
I have the following code that does not seem
 to operate at all.
   
I want phone1type to be a required field _if_
 the phone1 attribute is
_not_

   
field  property=phone1type
depends=requiredif
arg0 key=form.phone1type/
var
   
 var-namefield[0]/var-name
   
 var-valuephone1/var-value
/var
var
   
 var-namefieldTest[0]/var-name
   
 var

RE: requiredif question

2003-06-25 Thread Mick Knutson
I extend org.apache.struts.validator.ValidatorActionForm and all my normal 
validation works except the requiredif.



---
Thanks...
Mick Knutson
---




From: Sandeep Takhar [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: RE: requiredif question
Date: Wed, 25 Jun 2003 15:21:50 -0700 (PDT)
Are you extending ValidatorForm?

sandeep
--- Kamholz, Keith   (corp-staff) USX
[EMAIL PROTECTED] wrote:
 Here's my struts-config and my validation.xml.  I've
 also attached them, if
 it's easier to look at that way.  I've only shown
 parts of my
 struts-config.xml, enough to show one example action
 that isn't validating
 right.
 ___

 Struts-Config snippets:

 form-beans
form-bean name=ansm
 type=com.moog.us.app.ans.data.AnsmItem/
form-bean name=ansa
 type=com.moog.us.app.ans.data.AnsaItem/
 /form-beans

 action path=/AddFormat
 type=com.moog.us.app.ans.action.AddANSM
validate=true
name=ansm
scope=request
input=tiles.addFormat/

 controller

processorClass=com.moog.us.struts.AppRequestProcessor
 /

 message-resources
 parameter=ApplicationResources/

 plug-in
 className=com.moog.us.struts.AppStartupPlugin/
 plug-in
 className=org.apache.struts.tiles.TilesPlugin 
 set-property property=definitions-config
 value=/WEB-INF/tiles-defs.xml /
 set-property property=moduleAware
 value=true /
set-property
 property=definitions-parser-validate value=true
 /
 /plug-in
 plug-in

className=org.apache.struts.validator.ValidatorPlugIn
set-property
 property=pathnames


value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/
 /plug-in

 ___

 Validation.xml:

 ?xml version=1.0 encoding=ISO-8859-1 ?

 !DOCTYPE form-validation PUBLIC
   -//Apache Software Foundation//DTD
 Commons Validator Rules
 Configuration 1.0//EN


http://jakarta.apache.org/commons/dtds/validator_1_0.dtd;

 form-validation

 global
 /global

formset
form name=ansm
field   property=numberType
depends=required
arg0 key=app.label.numberType/
/field
field   property=typeDesc
depends=required
arg0 key=app.label.numberType/
/field
/form
/formset

 /form-validation




 If I should send any other files, let me know.
 Any input would be great, thanks!


 - Keith







 -Original Message-
 From: Mick Knutson [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 25, 2003 1:32 PM
 To: [EMAIL PROTECTED]
 Subject: RE: requiredif question


 I did not see yours. Can you post your code again?



 ---
 Thanks...
 Mick Knutson
 ---





 From: Kamholz, Keith   (corp-staff) USX
 [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List
 [EMAIL PROTECTED]
 To: 'Struts Users Mailing List'
 [EMAIL PROTECTED]
 Subject: RE: requiredif question
 Date: Wed, 25 Jun 2003 13:26:48 -0400
 
 I'm having a similar problem.  All I'm trying to do
 is have a 'required'
 condition for 2 fields of my form.  Mine submits
 just fine when I leave it
 blank as well.  I posted my code here yesterday,
 but nobody was able to
 help
 me.  If you figure this out, I'd appreciate it if
 you let me know what the
 problem is.  I'll do the same!
 
 - Keith
 
 
 -Original Message-
 From: Mick Knutson [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 25, 2003 1:26 PM
 To: [EMAIL PROTECTED]
 Subject: Re: requiredif question
 
 
 Yes, no matter what I enter, nothing happends at
 all. It just accepts
 whatever I enter, or leave blank, and submits just
 fine.
 
 
 
 ---
 Thanks...
 Mick Knutson
 ---
 
 
 
 
 
  From: Kevin Robair [EMAIL PROTECTED]
  Reply-To: Struts Users Mailing List
 [EMAIL PROTECTED]
  To: Struts Users Mailing List
 [EMAIL PROTECTED]
  Subject: Re: requiredif question
  Date: Wed, 25 Jun 2003 10:20:35 -0700 (PDT)
  
  Just a hunch:
  
  For Struts 1.1RC1 , the varnames should be:
  
  field-test[x]
  field-join
  etc...
  
  In 1.1RC2, they are
  
  fieldTest[n]
  fieldJoin
  etc
  
  BTW, I am unsure what you mean by:
  
 does not seem to operate at all
  
  Are there any errors or exceptions in the log? If
 the form validates no
  matter what you enter, and there are no errors in
 the log, then it is
  possibly a configuration problem. You could try a
 simpler validation, in
  place of this one just to make sure it is doing
 something. Then, remove
  the NOTNULL check, and see if the NOTEQUAL alone
 works.
  
  -Kevin
  
  --- Mick Knutson [EMAIL PROTECTED] wrote:
I have the following code that does not seem
 to operate at all.
   
I want phone1type to be a required field _if_
 the phone1 attribute is
_not_

   
field  property=phone1type
depends=requiredif
arg0 key=form.phone1type

Re: RC2 requiredif validation rule syntax change

2003-06-16 Thread Reinhard Nägele
Thanks for pointing this out. I wonder nobody else has responded to your 
message.

What's the point of that kind of change? I read the release notes and 
couldn't find anything about this. That's the place where such kinds of 
changes ought to be listed!

Reinhard

Kevin Robair wrote:

FYI:

While testing my app with RC2, I noticed this:

In RC1, the requiredif validator rule used these tags:

field-test[n]
field-value[n]
field-join[n]
In RC2, it uses:

fieldValue[n]
fieldTest[n]
fieldJoin[n]
If you are getting a reflection error / null pointer
exception, this is why. 

-Kevin



-
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: RC2 requiredif validation rule syntax change

2003-06-16 Thread David Graham
What's the point of that kind of change?
The '-' character is not a valid javascript variable character so we removed 
it.

David

I read the release notes and couldn't find anything about this. That's the 
place where such kinds of changes ought to be listed!

Reinhard

Kevin Robair wrote:

FYI:

While testing my app with RC2, I noticed this:

In RC1, the requiredif validator rule used these tags:

field-test[n]
field-value[n]
field-join[n]
In RC2, it uses:

fieldValue[n]
fieldTest[n]
fieldJoin[n]
If you are getting a reflection error / null pointer
exception, this is why.
-Kevin



-
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]
_
Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail

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


Help with requiredif validation

2003-06-11 Thread Brian McSweeney
Hi all,

I'd like to use requiredif to validate some fields as follows:

on my jsp I have a checkbox, eg supplier,

if this checkbox is checked, then I want another field, eg name to be required.
I've tried to set this up in my validation.xml file as follows:

  field property=name
 depends=requiredif

  arg0 key=validateForm.name/
  arg0
  name=requiredif
  key=A name is
  resource=false
  /
  var
var-namevalidateForm.supplier/var-name
var-valuetrue/var-value
  /var

however it doesn't seem to be working at all.
Any ideas?
thanks,
Brian

PS - other fields are being validated correctly.

RE: Help with requiredif validation

2003-06-11 Thread Suresh Babu
Try this

 arg1
  name=requiredif
  key=A name is
  resource=false
  /


 --
 From: Brian McSweeney[SMTP:[EMAIL PROTECTED]
 Reply To: Struts Users Mailing List
 Sent: Wednesday, June 11, 2003 9:36 PM
 To:   Struts Users Mailing List
 Subject:  Help with requiredif validation
 
 Hi all,
 
 I'd like to use requiredif to validate some fields as follows:
 
 on my jsp I have a checkbox, eg supplier,
 
 if this checkbox is checked, then I want another field, eg name to be
 required.
 I've tried to set this up in my validation.xml file as follows:
 
   field property=name
  depends=requiredif
 
   arg0 key=validateForm.name/
   arg0
   name=requiredif
   key=A name is
   resource=false
   /
   var
 var-namevalidateForm.supplier/var-name
 var-valuetrue/var-value
   /var
 
 however it doesn't seem to be working at all.
 Any ideas?
 thanks,
 Brian
 
 PS - other fields are being validated correctly.
 

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



RC2 requiredif validation rule syntax change

2003-06-10 Thread Kevin Robair
FYI:

While testing my app with RC2, I noticed this:

In RC1, the requiredif validator rule used these tags:

field-test[n]
field-value[n]
field-join[n]

In RC2, it uses:

fieldValue[n]
fieldTest[n]
fieldJoin[n]

If you are getting a reflection error / null pointer
exception, this is why. 

-Kevin



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



[validator] requiredif based on a value

2003-04-04 Thread Raible, Matt
Is it possible to require a field based on the value of another field?  I
tried the following, but no dice:

  field property=effectiveDate
 depends=requiredif

  arg0 key=changeRequestFormEx.effectiveDate/
  var
var-namefield/var-name
var-valuestate/var-value
  /var
  var
var-namefieldTest/var-name
var-valueEQUAL/var-value
  /var
  var
var-namefieldValue/var-name
var-value940/var-value
  /var
  /field

Thanks,

Matt


-
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 property=effectiveDate
 depends=requiredif
  arg0 key=changeRequestFormEx.effectiveDate/
  var
var-namefield/var-name
var-valuestate/var-value
  /var
  var
var-namefieldTest/var-name
var-valueEQUAL/var-value
  /var
  var
var-namefieldValue/var-name
var-value940/var-value
  /var
  /field
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 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:
 
field property=effectiveDate
   depends=requiredif
 
arg0 key=changeRequestFormEx.effectiveDate/
var
  var-namefield/var-name
  var-valuestate/var-value
/var
var
  var-namefieldTest/var-name
  var-valueEQUAL/var-value
/var
var
  var-namefieldValue/var-name
  var-value940/var-value
/var
/field
 
 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]



requiredif and null

2003-03-31 Thread John . E . Gregg
Hi all,
 
I'm doing validation on a form where I have 3 dependent fields.  If any one
is present, they all must be present.  I set-up my validation by saying A
depends on B depends on C depends on A.  I know this worked at one time.
Currently I'm using 1.1 rc1 and previously was using 1.1 b3.  I don't know
when this stopped working.  While stepping though the jsp generation with a
debugger, I can see that value= is being written even when the form values
are null.  The server-side validation then sees empty strings instead of
nulls, so my validation doesn't work.  BaseFieldTag.doStartTag() is
automatically writing empty strings instead of nulls.  Should I take a
completely different approach?
 
thanks
 
john
 
 
john gregg
Wells Fargo Services Company
Minneapolis, MN
 


Requiredif and Javascript

2003-03-13 Thread Evan Schnell
Has anyone ever enabled javascript validation on a form that included a 
requiredif rule?  

Is it correct to assume that this never should be done?

Because field-test is an illegal variable name in javascript it seems 
to me that this is the case.  

It is time for us to fish or cut bait.  
Evan.



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


Mask validation BUG with requiredif

2003-03-13 Thread Greg Hess
Hi All, 
 
I have just started using the requiredif validation rule with a field
that is also being validated with a mask rule. The server side
validation is working fine but the client side JavaScript has errors for
my requiredif form fields. 
My form field requires the feild button2URL only if button2Lbl has been
entered and if button2URL it must pass the mask rule. 
 
When I use my mask without the requiredif rule all is well in client
JavaScript the generated method is as follows:
 
function mask () { 
 this.aa = new Array(button2URL, Button 2 URL must contain a
valid URL. For more information click the help icon., new Function
(varName, this.mask=/^http:\\/\\/|^file:\\/\\/|^mailto:[^ ]*$/;
return this[varName];));
} 
 
When the requiredif rule is added and the JavaScript breaks and the
generated method is:
 
function mask () { 
 this.aa = new Array(button2URL, Button 2 URL must contain a
valid URL. For more information click the help icon., new Function
(varName, this.field-test[0]='NOTNULL'; this.field[0]='button2Lbl';
this.mask=/^http:\\/\\/|^file:\\/\\/|^mailto:[^ ]*$/;  return
this[varName];));
} 
 
Below is my validation def for this form:
 
field property=button2Lbl depends=required
 
arg0 key=wbConfigForm.button2Lbl/
 
/field
 
field property=button2URL depends=requiredif,mask
 
msg name=mask key=error.invalidURL/
 
arg0 key=wbConfigForm.button2URL/
 
var
 
var-namemask/var-name
 
var-value^http:\/\/|^file:\/\/|^mailto:[^ ]*$/var-value
 
/var
 
var
 
var-namefield[0]/var-name
 
var-valuebutton2Lbl/var-value
 
/var
 
var
 
var-namefield-test[0]/var-name
 
var-valueNOTNULL/var-value
 
/var 
 
/field
 
/form
 
I have accepted that for now I will create my own static JavaScript for
the form to handle the requirdif fields but I would still like to use
the other rules and their client side validation with my reqiredif
fields. 
 
Many thanks,
 
Greg
 


Re: Mask validation BUG with requiredif

2003-03-13 Thread Evan Schnell
Greg Hess wrote:

Hi All, 

I have just started using the requiredif validation rule with a field
that is also being validated with a mask rule. The server side
validation is working fine but the client side JavaScript has errors for
my requiredif form fields. 
 

I cannot seem to get any client-side validation to work when requiredif 
is turned on.  I wrote my own javascript rule that is supposed to always 
return true.  However mozilla's javascript engine (and presumably IE's 
because both give the same end behavior) will not allow a variable to be 
named field-test or field-join.  

Specifically the bug is in:

this.ae = new Array(lastName, Last Name can not be less than 2 
characters., new Function (varName, this.field[0]='firstName'; 
this.field-test[0]='NOTNULL'; this.minlength=2;  return this[varName];));

The only workaround I can see is to follow advice previously posted on 
this list and not attempt client side requiredif,  Then I can hack 
JavascriptValidatorTag.java to support a new jsType called omit which 
will prevent the variable from being included in the javascript at all.

Regards, Evan.



smime.p7s
Description: S/MIME Cryptographic Signature


Validation mask rule JavaScript breaks with requiredif?

2003-03-12 Thread Greg Hess
Hi All, 
 
I have just started using the requiredif validation rule. The server
side validation is working fine but the client side JavaScript has
errors for my requiredif form fields. 
My form field requires the feild button2URL only if button2Lbl has been
entered and if button2URL it must pass the mask rule. I am by no means a
JavaScript expert but I think I can identify where the problem is. 
 
When I use my mask without the requiredif rule all is well in client
JavaScript the generated method is as follows:
 
function mask () { 
 this.aa = new Array(button2URL, Button 2 URL must contain a
valid URL. For more information click the help icon., new Function
(varName, this.mask=/^http:\\/\\/|^file:\\/\\/|^mailto:[^ ]*$/;
return this[varName];));
} 
 
When the requiredif rule is added and the JavaScript breaks and the
generated method is:
 
function mask () { 
 this.aa = new Array(button2URL, Button 2 URL must contain a
valid URL. For more information click the help icon., new Function
(varName, this.field-test[0]='NOTNULL'; this.field[0]='button2Lbl';
this.mask=/^http:\\/\\/|^file:\\/\\/|^mailto:[^ ]*$/;  return
this[varName];));
} 
 
As the case may be I have probably confiured my validation rule wrong so
below is my validation def for this form:

field property=button2Lbl depends=required

arg0 key=wbConfigForm.button2Lbl/

/field

field property=button2URL depends=requiredif,mask

msg name=mask key=error.invalidURL/

arg0 key=wbConfigForm.button2URL/

var

var-namemask/var-name

var-value^http:\/\/|^file:\/\/|^mailto:[^ ]*$/var-value

/var

var

var-namefield[0]/var-name

var-valuebutton2Lbl/var-value

/var

var

var-namefield-test[0]/var-name

var-valueNOTNULL/var-value

/var 

/field

/form

I have accepted that for now I will create my own static JavaScript for
the form to handle the requirdif fields but I would still like to use
the other rules and their client side validation with my reqiredif
fields. Is there anyway I can achieve this. Even though my server side
validation is ok, I cant publish these pages with JavaScript errors on
form post. So if I cant correct this bug I will have to remove this
fields validation from the validator :-(.

Many thanks,

Greg

 

 

 


Where's the JavaScript validation for requiredif?

2003-03-11 Thread Greg Hess
Hi All,
 
I really like the new requiredif validation rule with rc1 what a great
addition. I am wondering if there is a reason that it's implementation
has omitted the JavaScript validation method? Is it coming?
 
I have been looking at implementing my own JavaScript method for this
rule but do not know how provide the required Arrays that are being auto
generated to support the JavaScript method defined in
validator-rules.xml.
 
Greg
 
 


RE: Where's the JavaScript validation for requiredif?

2003-03-11 Thread James Turner
It's missing because (A) I don't claim to be a great Javascript
developer and (B) I frankly think it would be almost impossible to
generate Javascript for it, given how complex it is.  This will be even
more true of the validwhen rule I'm going to introduce in Struts 1.2,
which generalizes all form dependency validations.  So, at least until a
Javascript guru wants to take a crack at it, requiredif is strictly
server-side.

James

 -Original Message-
 From: Greg Hess [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, March 11, 2003 5:19 PM
 To: Struts
 Subject: Where's the JavaScript validation for requiredif?
 
 
 Hi All,
  
 I really like the new requiredif validation rule with rc1 
 what a great addition. I am wondering if there is a reason 
 that it's implementation has omitted the JavaScript 
 validation method? Is it coming?
  
 I have been looking at implementing my own JavaScript method 
 for this rule but do not know how provide the required Arrays 
 that are being auto generated to support the JavaScript 
 method defined in validator-rules.xml.
  
 Greg
  
  
 



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



Validation - requiredif

2003-02-25 Thread Rieberger, Dale
Looking for an example of requiredif that is similar to the example on the struts site 
but without using an index and using ValidationForm not DynaValidationForm. If that 
isn't possible could someone explain the index example for me. I dont understand the 
struts-config entries especially where in talks about Dependent[].

Dale Rieberger


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



Re: Validation - requiredif

2003-02-25 Thread Jeff Kyser
Hey Dale,

Scroll back to yesterday morning, about 9:20 CST, there's
an example posted for Zsolt that worked for him.
regards,

-jeff

On Tuesday, February 25, 2003, at 03:56  PM, Rieberger, Dale wrote:

Looking for an example of requiredif that is similar to the example on 
the struts site but without using an index and using ValidationForm 
not DynaValidationForm. If that isn't possible could someone explain 
the index example for me. I dont understand the struts-config entries 
especially where in talks about Dependent[].

Dale Rieberger

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

2003-02-25 Thread Rieberger, Dale
Ok, it works if I dont use a date field as the field I am trying to check against. So 
if I use to text fields one is required if the other is not null it works, but it 
doesn't work if one field is required if the second field is a date and not null.

Thanks for your help Jeff.

-Original Message-
From: Jeff Kyser [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 25, 2003 3:01 PM
To: Struts Users Mailing List
Subject: Re: Validation - requiredif


Hey Dale,

Scroll back to yesterday morning, about 9:20 CST, there's
an example posted for Zsolt that worked for him.

regards,

-jeff

On Tuesday, February 25, 2003, at 03:56  PM, Rieberger, Dale wrote:

 Looking for an example of requiredif that is similar to the example on 
 the struts site but without using an index and using ValidationForm 
 not DynaValidationForm. If that isn't possible could someone explain 
 the index example for me. I dont understand the struts-config entries 
 especially where in talks about Dependent[].

 Dale Rieberger


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



[REPOST] [Validator] REQUIREDIF Question

2003-02-14 Thread Jerry Jalenak
I'm reposting this in the hope that someone can tell what I'm doing wrong.
I can't seem to figure out why this doesn't work.  Any (and all) help is
greatly appreciated

I have a rather simple form with 4 fields on it.  If the first field
(patientId) is left blank, then the other three fields (lastName, firstName,
dob) are required.  So, in struts-config I have

snip
form-bean name=UserInfo
type=org.apache.struts.validator.DynaValidatorForm
form-property name=lastName
type=java.lang.String/
form-property name=firstName
type=java.lang.String/
form-property name=dob
type=java.lang.String/
form-property name=patientId
type=java.lang.String/
/form-bean
/snip

and in my validator-rules I am using

snip
formset
form name=UserInfo
field property=patientId depends=mask
msg name=mask key=errors.field.invalid
/
arg0 key=UserInfo.patientId.displayname
/
var
var-namemask/var-name
var-value^[0-9]+$/var-value
/var
/field
field property=lastName depends=requiredif,
mask
msg name=requiredif
key=errors.field.required /
msg name=mask key=errors.field.invalid
/
arg0 key=UserInfo.lastName.displayname /
var
var-namemask/var-name
var-value^[A-Za-z
-']+$/var-value
/var
var
var-namefield[0]/var-name
var-valuepatientId/var-value
/var
var
var-namefield-test[0]/var-name
var-valueNULL/var-value
/var
/field
field property=firstName depends=requiredif,
mask
msg name=requiredif
key=errors.field.required /
msg name=mask key=errors.field.invalid
/
arg0 key=UserInfo.firstName.displayname
/
var
var-namemask/var-name
var-value^[A-Za-z
-']+$/var-value
/var
var
var-namefield[0]/var-name
var-valuepatientId/var-value
/var
var
var-namefield-test[0]/var-name
var-valueNULL/var-value
/var
/field
field property=dob depends=requiredif, mask
msg name=requiredif
key=errors.field.required /
msg name=mask key=errors.field.invalid
/
arg0 key=UserInfo.dob.displayname /
var
var-namemask/var-name
var-value^[0-9]+$/var-value
/var
var
var-namefield[0]/var-name
var-valuepatientId/var-value
/var
var
var-namefield-test[0]/var-name
var-valueNULL/var-value
/var
/field
/form
/formset
/snip

The REQUIREDIF check does not seem to be working as the validation is passed
successfully.  I suspect it has something to do with the form property being
a String, but being checked against a NULL in validator.  I checked the
validator docs and this appears to be the correct way of doing this.  Am I
just missing something obvious?

TIA!

Jerry Jalenak
Web Publishing
LabOne, Inc.
10101 Renner Blvd.
Lenexa, KS  66219
(913) 577-1496
[EMAIL PROTECTED]



This transmission (and any information attached to it) may be confidential and is 
intended solely for the use of the individual or entity to which it is addressed. If 
you are not the intended recipient or the person responsible for delivering the 
transmission to the intended recipient, be advised that you have received this 
transmission in error

RE: [REPOST] [Validator] REQUIREDIF Question

2003-02-14 Thread Sri Sankaran
Nothing out of the ordinary jumps out from what you have sent.  That being said, 
following are a few points; a list which you have probably already checked and 
double-checked:

* Have you set the validator plug-in element in the 
  struts-config?
* Is the name of the form-bean in the action mapping also
  UserInfo?
* Have you ensured that the requiredIf logic is being invoked
  at all?  You could test this by say, changing the logic 
  (just for test purposes).  For example, change the NULL 
  criterion to some dummy string literal.  Then actually enter 
  that literal on the JSP and see if the requiredif logic 
  is triggered

Sri

-Original Message-
From: Jerry Jalenak [mailto:[EMAIL PROTECTED]] 
Sent: Friday, February 14, 2003 8:38 AM
To: '[EMAIL PROTECTED]'
Subject: [REPOST] [Validator] REQUIREDIF Question


I'm reposting this in the hope that someone can tell what I'm doing wrong. I can't 
seem to figure out why this doesn't work.  Any (and all) help is greatly 
appreciated

I have a rather simple form with 4 fields on it.  If the first field
(patientId) is left blank, then the other three fields (lastName, firstName,
dob) are required.  So, in struts-config I have

snip
form-bean name=UserInfo 
type=org.apache.struts.validator.DynaValidatorForm
form-property name=lastName
type=java.lang.String/
form-property name=firstName
type=java.lang.String/
form-property name=dob
type=java.lang.String/
form-property name=patientId
type=java.lang.String/
/form-bean
/snip

and in my validator-rules I am using

snip
formset
form name=UserInfo
field property=patientId depends=mask
msg name=mask key=errors.field.invalid
/
arg0 key=UserInfo.patientId.displayname
/
var
var-namemask/var-name
var-value^[0-9]+$/var-value
/var
/field
field property=lastName depends=requiredif,
mask
msg name=requiredif
key=errors.field.required /
msg name=mask key=errors.field.invalid
/
arg0 key=UserInfo.lastName.displayname /
var
var-namemask/var-name
var-value^[A-Za-z
-']+$/var-value
/var
var
var-namefield[0]/var-name
var-valuepatientId/var-value
/var
var
var-namefield-test[0]/var-name
var-valueNULL/var-value
/var
/field
field property=firstName depends=requiredif,
mask
msg name=requiredif
key=errors.field.required /
msg name=mask key=errors.field.invalid
/
arg0 key=UserInfo.firstName.displayname
/
var
var-namemask/var-name
var-value^[A-Za-z
-']+$/var-value
/var
var
var-namefield[0]/var-name
var-valuepatientId/var-value
/var
var
var-namefield-test[0]/var-name
var-valueNULL/var-value
/var
/field
field property=dob depends=requiredif, mask
msg name=requiredif
key=errors.field.required /
msg name=mask key=errors.field.invalid
/
arg0 key=UserInfo.dob.displayname /
var
var-namemask/var-name
var-value^[0-9]+$/var-value
/var
var
var-namefield[0]/var-name
var-valuepatientId/var-value
/var
var
var-namefield-test[0]/var-name
var-valueNULL/var-value
/var
/field
/form

RE: [REPOST] [Validator] REQUIREDIF Question

2003-02-14 Thread Jerry Jalenak
Sri - thanks for the reply.  We have several other validations going on with
this form-bean, so I'm confident that your first two items are OK.  I've
also pulled the 'REQUIREDIF' check out of the validation in question
(leaving just the MASK) and everything behaves correctly.  I've also been
over the validator docs countless times, and have verified that the general
approach matches what is in the doc.  The only thing I can come up with is
that the MASK processing is screwing things up some way

I'm about to a point of writing a custom validation routine just to get by
this, but would sure like to use the REQUIREDIF

Jerry

 -Original Message-
 From: Sri Sankaran [mailto:[EMAIL PROTECTED]]
 Sent: Friday, February 14, 2003 8:35 AM
 To: Struts Users Mailing List
 Subject: RE: [REPOST] [Validator] REQUIREDIF Question
 
 
 Nothing out of the ordinary jumps out from what you have 
 sent.  That being said, following are a few points; a list 
 which you have probably already checked and double-checked:
 
 * Have you set the validator plug-in element in the 
   struts-config?
 * Is the name of the form-bean in the action mapping also
   UserInfo?
 * Have you ensured that the requiredIf logic is being invoked
   at all?  You could test this by say, changing the logic 
   (just for test purposes).  For example, change the NULL 
   criterion to some dummy string literal.  Then actually enter 
   that literal on the JSP and see if the requiredif logic 
   is triggered
 
 Sri
 
 -Original Message-
 From: Jerry Jalenak [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, February 14, 2003 8:38 AM
 To: '[EMAIL PROTECTED]'
 Subject: [REPOST] [Validator] REQUIREDIF Question
 
 
 I'm reposting this in the hope that someone can tell what I'm 
 doing wrong. I can't seem to figure out why this doesn't 
 work.  Any (and all) help is greatly appreciated
 
 I have a rather simple form with 4 fields on it.  If the first field
 (patientId) is left blank, then the other three fields 
 (lastName, firstName,
 dob) are required.  So, in struts-config I have
 
 snip
   form-bean name=UserInfo 
 type=org.apache.struts.validator.DynaValidatorForm
   form-property name=lastName
 type=java.lang.String/
   form-property name=firstName
 type=java.lang.String/
   form-property name=dob
 type=java.lang.String/
   form-property name=patientId
 type=java.lang.String/
   /form-bean
 /snip
 
 and in my validator-rules I am using
 
 snip
   formset
   form name=UserInfo
   field property=patientId depends=mask
   msg name=mask 
 key=errors.field.invalid
 /
   arg0 
 key=UserInfo.patientId.displayname
 /
   var
   var-namemask/var-name
   var-value^[0-9]+$/var-value
   /var
   /field
   field property=lastName depends=requiredif,
 mask
   msg name=requiredif
 key=errors.field.required /
   msg name=mask 
 key=errors.field.invalid
 /
   arg0 
 key=UserInfo.lastName.displayname /
   var
   var-namemask/var-name
   var-value^[A-Za-z
 -']+$/var-value
   /var
   var
   var-namefield[0]/var-name
   var-valuepatientId/var-value
   /var
   var
   
 var-namefield-test[0]/var-name
   var-valueNULL/var-value
   /var
   /field
   field property=firstName depends=requiredif,
 mask
   msg name=requiredif
 key=errors.field.required /
   msg name=mask 
 key=errors.field.invalid
 /
   arg0 
 key=UserInfo.firstName.displayname
 /
   var
   var-namemask/var-name
   var-value^[A-Za-z
 -']+$/var-value
   /var
   var
   var-namefield[0]/var-name
   var-valuepatientId/var-value
   /var
   var
   
 var-namefield-test[0]/var-name
   var-valueNULL/var-value
   /var
   /field
   field property=dob 
 depends=requiredif, mask

RE: [REPOST] [Validator] REQUIREDIF Question

2003-02-14 Thread Sri Sankaran
 The only thing I can come up with is that the MASK 
 processing is screwing things up some way
 

One way to confirm that would be to remove the mask test.

 Jerry

Sri

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




RE: [REPOST] [Validator] REQUIREDIF Question

2003-02-14 Thread James Turner
I'll take a look at this later today.  There have been a number of
people saying that they have had problems with REQUIREDIF, so I want to
make sure it's still working.

James

 -Original Message-
 From: Jerry Jalenak [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, February 14, 2003 8:38 AM
 To: '[EMAIL PROTECTED]'
 Subject: [REPOST] [Validator] REQUIREDIF Question
 
 
 I'm reposting this in the hope that someone can tell what I'm 
 doing wrong. I can't seem to figure out why this doesn't 
 work.  Any (and all) help is greatly appreciated
 
 I have a rather simple form with 4 fields on it.  If the first field
 (patientId) is left blank, then the other three fields 
 (lastName, firstName,
 dob) are required.  So, in struts-config I have
 
 snip
   form-bean name=UserInfo 
 type=org.apache.struts.validator.DynaValidatorForm
   form-property name=lastName
 type=java.lang.String/
   form-property name=firstName
 type=java.lang.String/
   form-property name=dob
 type=java.lang.String/
   form-property name=patientId
 type=java.lang.String/
   /form-bean
 /snip
 
 and in my validator-rules I am using
 
 snip
   formset
   form name=UserInfo
   field property=patientId depends=mask
   msg name=mask 
 key=errors.field.invalid
 /
   arg0 
 key=UserInfo.patientId.displayname
 /
   var
   var-namemask/var-name
   var-value^[0-9]+$/var-value
   /var
   /field
   field property=lastName depends=requiredif,
 mask
   msg name=requiredif
 key=errors.field.required /
   msg name=mask 
 key=errors.field.invalid
 /
   arg0 
 key=UserInfo.lastName.displayname /
   var
   var-namemask/var-name
   var-value^[A-Za-z
 -']+$/var-value
   /var
   var
   var-namefield[0]/var-name
   var-valuepatientId/var-value
   /var
   var
   
 var-namefield-test[0]/var-name
   var-valueNULL/var-value
   /var
   /field
   field property=firstName depends=requiredif,
 mask
   msg name=requiredif
 key=errors.field.required /
   msg name=mask 
 key=errors.field.invalid
 /
   arg0 
 key=UserInfo.firstName.displayname
 /
   var
   var-namemask/var-name
   var-value^[A-Za-z
 -']+$/var-value
   /var
   var
   var-namefield[0]/var-name
   var-valuepatientId/var-value
   /var
   var
   
 var-namefield-test[0]/var-name
   var-valueNULL/var-value
   /var
   /field
   field property=dob 
 depends=requiredif, mask
   msg name=requiredif
 key=errors.field.required /
   msg name=mask 
 key=errors.field.invalid
 /
   arg0 key=UserInfo.dob.displayname /
   var
   var-namemask/var-name
   var-value^[0-9]+$/var-value
   /var
   var
   var-namefield[0]/var-name
   var-valuepatientId/var-value
   /var
   var
   
 var-namefield-test[0]/var-name
   var-valueNULL/var-value
   /var
   /field
   /form
   /formset
 /snip
 
 The REQUIREDIF check does not seem to be working as the 
 validation is passed successfully.  I suspect it has 
 something to do with the form property being a String, but 
 being checked against a NULL in validator.  I checked the 
 validator docs and this appears to be the correct way of 
 doing this.  Am I just missing something obvious?
 
 TIA!
 
 Jerry Jalenak
 Web Publishing
 LabOne, Inc.
 10101 Renner Blvd.
 Lenexa, KS  66219
 (913

RE: [REPOST] [Validator] REQUIREDIF Question

2003-02-14 Thread James Turner
The problem, sir, lies not in your requiredif, but in your mask.

When you say:

var-value^[A-Za-z -']+$/var-value

What you're literally saying is A to Z, a to z, and space to '.  What
you want to say is:

var-value^[A-Za-z\ \-\']+$/var-value

When I used the correct mask, everything worked correctly. (i.e., if
patientId was blank, the other three fields were required and had to
obey the mask.  If patientId was not black, the other three could be.)

James

 -Original Message-
 From: Jerry Jalenak [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, February 14, 2003 10:02 AM
 To: 'Struts Users Mailing List'
 Subject: RE: [REPOST] [Validator] REQUIREDIF Question
 
 
 Sri - thanks for the reply.  We have several other 
 validations going on with this form-bean, so I'm confident 
 that your first two items are OK.  I've also pulled the 
 'REQUIREDIF' check out of the validation in question (leaving 
 just the MASK) and everything behaves correctly.  I've also 
 been over the validator docs countless times, and have 
 verified that the general approach matches what is in the 
 doc.  The only thing I can come up with is that the MASK 
 processing is screwing things up some way
 
 I'm about to a point of writing a custom validation routine 
 just to get by this, but would sure like to use the REQUIREDIF
 
 Jerry
 
  -Original Message-
  From: Sri Sankaran [mailto:[EMAIL PROTECTED]]
  Sent: Friday, February 14, 2003 8:35 AM
  To: Struts Users Mailing List
  Subject: RE: [REPOST] [Validator] REQUIREDIF Question
  
  
  Nothing out of the ordinary jumps out from what you have
  sent.  That being said, following are a few points; a list 
  which you have probably already checked and double-checked:
  
  * Have you set the validator plug-in element in the 
struts-config?
  * Is the name of the form-bean in the action mapping also
UserInfo?
  * Have you ensured that the requiredIf logic is being invoked
at all?  You could test this by say, changing the logic 
(just for test purposes).  For example, change the NULL 
criterion to some dummy string literal.  Then actually enter 
that literal on the JSP and see if the requiredif logic 
is triggered
  
  Sri
  
  -Original Message-
  From: Jerry Jalenak [mailto:[EMAIL PROTECTED]]
  Sent: Friday, February 14, 2003 8:38 AM
  To: '[EMAIL PROTECTED]'
  Subject: [REPOST] [Validator] REQUIREDIF Question
  
  
  I'm reposting this in the hope that someone can tell what I'm
  doing wrong. I can't seem to figure out why this doesn't 
  work.  Any (and all) help is greatly appreciated
  
  I have a rather simple form with 4 fields on it.  If the first field
  (patientId) is left blank, then the other three fields
  (lastName, firstName,
  dob) are required.  So, in struts-config I have
  
  snip
  form-bean name=UserInfo
  type=org.apache.struts.validator.DynaValidatorForm
  form-property name=lastName
  type=java.lang.String/
  form-property name=firstName
  type=java.lang.String/
  form-property name=dob
  type=java.lang.String/
  form-property name=patientId
  type=java.lang.String/
  /form-bean
  /snip
  
  and in my validator-rules I am using
  
  snip
  formset
  form name=UserInfo
  field property=patientId depends=mask
  msg name=mask
  key=errors.field.invalid
  /
  arg0 
  key=UserInfo.patientId.displayname
  /
  var
  var-namemask/var-name
  var-value^[0-9]+$/var-value
  /var
  /field
  field property=lastName depends=requiredif,
  mask
  msg name=requiredif
  key=errors.field.required /
  msg name=mask 
  key=errors.field.invalid
  /
  arg0 
  key=UserInfo.lastName.displayname /
  var
  var-namemask/var-name
  var-value^[A-Za-z
  -']+$/var-value
  /var
  var
  var-namefield[0]/var-name
  var-valuepatientId/var-value
  /var
  var
  
  var-namefield-test[0]/var-name
  var-valueNULL/var-value
  /var
  /field
  field property=firstName depends=requiredif,
  mask
  msg name=requiredif
  key=errors.field.required /
  msg name=mask
  key=errors.field.invalid
  /
  arg0 
  key=UserInfo.firstName.displayname

RE: [REPOST] [Validator] REQUIREDIF Question

2003-02-14 Thread Jerry Jalenak
James,

You, sir, are wy wiser in the use of regular expressions than I hope to
ever be. The whole escape this, don't escape that thing continues to
confound me.  Anyway, I've updated my validator.xml with the changes to the
mask, and it appears to be working (i.e. it returns to the original input
form).  However, I am not getting any messages displayed via my
html:errors/ tag.  I've checked and the default validator messages are in
my ApplicationResources.properties, and have verified that it is being
loaded (at least according to the Tomcat console log).  Has something
changed in how messages are rendered recently?  I'm using the nightly build
from Feb. 10, 2003   Any ideas?

TIA!

Jerry

 -Original Message-
 From: James Turner [mailto:[EMAIL PROTECTED]]
 Sent: Friday, February 14, 2003 11:48 AM
 To: 'Struts Users Mailing List'
 Cc: [EMAIL PROTECTED]
 Subject: RE: [REPOST] [Validator] REQUIREDIF Question
 
 
 The problem, sir, lies not in your requiredif, but in your mask.
 
 When you say:
 
 var-value^[A-Za-z -']+$/var-value
 
 What you're literally saying is A to Z, a to z, and space to 
 '.  What
 you want to say is:
 
 var-value^[A-Za-z\ \-\']+$/var-value
 
 When I used the correct mask, everything worked correctly. (i.e., if
 patientId was blank, the other three fields were required and had to
 obey the mask.  If patientId was not black, the other three could be.)
 
 James
 
  -Original Message-
  From: Jerry Jalenak [mailto:[EMAIL PROTECTED]] 
  Sent: Friday, February 14, 2003 10:02 AM
  To: 'Struts Users Mailing List'
  Subject: RE: [REPOST] [Validator] REQUIREDIF Question
  
  
  Sri - thanks for the reply.  We have several other 
  validations going on with this form-bean, so I'm confident 
  that your first two items are OK.  I've also pulled the 
  'REQUIREDIF' check out of the validation in question (leaving 
  just the MASK) and everything behaves correctly.  I've also 
  been over the validator docs countless times, and have 
  verified that the general approach matches what is in the 
  doc.  The only thing I can come up with is that the MASK 
  processing is screwing things up some way
  
  I'm about to a point of writing a custom validation routine 
  just to get by this, but would sure like to use the REQUIREDIF
  
  Jerry
  
   -Original Message-
   From: Sri Sankaran [mailto:[EMAIL PROTECTED]]
   Sent: Friday, February 14, 2003 8:35 AM
   To: Struts Users Mailing List
   Subject: RE: [REPOST] [Validator] REQUIREDIF Question
   
   
   Nothing out of the ordinary jumps out from what you have
   sent.  That being said, following are a few points; a list 
   which you have probably already checked and double-checked:
   
   * Have you set the validator plug-in element in the 
 struts-config?
   * Is the name of the form-bean in the action mapping also
 UserInfo?
   * Have you ensured that the requiredIf logic is being invoked
 at all?  You could test this by say, changing the logic 
 (just for test purposes).  For example, change the NULL 
 criterion to some dummy string literal.  Then actually enter 
 that literal on the JSP and see if the requiredif logic 
 is triggered
   
   Sri
   
   -Original Message-
   From: Jerry Jalenak [mailto:[EMAIL PROTECTED]]
   Sent: Friday, February 14, 2003 8:38 AM
   To: '[EMAIL PROTECTED]'
   Subject: [REPOST] [Validator] REQUIREDIF Question
   
   
   I'm reposting this in the hope that someone can tell what I'm
   doing wrong. I can't seem to figure out why this doesn't 
   work.  Any (and all) help is greatly appreciated
   
   I have a rather simple form with 4 fields on it.  If the 
 first field
   (patientId) is left blank, then the other three fields
   (lastName, firstName,
   dob) are required.  So, in struts-config I have
   
   snip
 form-bean name=UserInfo
   type=org.apache.struts.validator.DynaValidatorForm
 form-property name=lastName
   type=java.lang.String/
 form-property name=firstName
   type=java.lang.String/
 form-property name=dob
   type=java.lang.String/
 form-property name=patientId
   type=java.lang.String/
 /form-bean
   /snip
   
   and in my validator-rules I am using
   
   snip
 formset
 form name=UserInfo
 field property=patientId depends=mask
 msg name=mask
   key=errors.field.invalid
   /
 arg0 
   key=UserInfo.patientId.displayname
   /
 var
 var-namemask/var-name
 var-value^[0-9]+$/var-value
 /var
 /field
 field property=lastName depends=requiredif,
   mask
 msg name=requiredif
   key=errors.field.required /
 msg name=mask 
   key=errors.field.invalid

[Validator] REQUIREDIF Question

2003-02-12 Thread Jerry Jalenak
Hi All,

I have a rather simple form with 4 fields on it.  If the first field
(patientId) is left blank, then the other three fields (lastName, firstName,
dob) are required.  So, in struts-config I have

snip
form-bean name=UserInfo
type=org.apache.struts.validator.DynaValidatorForm
form-property name=lastName
type=java.lang.String/
form-property name=firstName
type=java.lang.String/
form-property name=dob
type=java.lang.String/
form-property name=patientId
type=java.lang.String/
/form-bean
/snip

and in my validator-rules I am using

snip
formset
form name=UserInfo
field property=patientId depends=mask
msg name=mask key=errors.field.invalid
/
arg0 key=UserInfo.patientId.displayname
/
var
var-namemask/var-name
var-value^[0-9]+$/var-value
/var
/field
field property=lastName depends=requiredif,
mask
msg name=requiredif
key=errors.field.required /
msg name=mask key=errors.field.invalid
/
arg0 key=UserInfo.lastName.displayname /
var
var-namemask/var-name
var-value^[A-Za-z
-']+$/var-value
/var
var
var-namefield[0]/var-name
var-valuepatientId/var-value
/var
var
var-namefield-test[0]/var-name
var-valueNULL/var-value
/var
/field
field property=firstName depends=requiredif,
mask
msg name=requiredif
key=errors.field.required /
msg name=mask key=errors.field.invalid
/
arg0 key=UserInfo.firstName.displayname
/
var
var-namemask/var-name
var-value^[A-Za-z
-']+$/var-value
/var
var
var-namefield[0]/var-name
var-valuepatientId/var-value
/var
var
var-namefield-test[0]/var-name
var-valueNULL/var-value
/var
/field
field property=dob depends=requiredif, mask
msg name=requiredif
key=errors.field.required /
msg name=mask key=errors.field.invalid
/
arg0 key=UserInfo.dob.displayname /
var
var-namemask/var-name
var-value^[0-9]+$/var-value
/var
var
var-namefield[0]/var-name
var-valuepatientId/var-value
/var
var
var-namefield-test[0]/var-name
var-valueNULL/var-value
/var
/field
/form
/formset
/snip

The REQUIREDIF check does not seem to be working as the validation is passed
successfully.  I suspect it has something to do with the form property being
a String, but being checked against a NULL in validator.  I checked the
validator docs and this appears to be the correct way of doing this.  Am I
just missing something obvious?

TIA!

Jerry Jalenak
Web Publishing
LabOne, Inc.
10101 Renner Blvd.
Lenexa, KS  66219
(913) 577-1496
[EMAIL PROTECTED]


This transmission (and any information attached to it) may be confidential and is 
intended solely for the use of the individual or entity to which it is addressed. If 
you are not the intended recipient or the person responsible for delivering the 
transmission to the intended recipient, be advised that you have received this 
transmission in error and that any use, dissemination, forwarding, printing, or 
copying of this information is strictly prohibited. If you have received this 
transmission in error, please

requiredif

2003-02-10 Thread Dinesh Samson J
Greetings,

My required if condition in validation.xml is not working.

The following is the code in my validation.xml file.

field property=lastName depends=requiredif
arg0 key=label.lastName/
var
var-namefield/var-name
var-valuefirstName/var-value
/var
var
var-namefield-test/var-name
var-valueNOTNULL/var-value
/var
/field

My condition is:
lastName should be present, if firstName is entered.

The validator throws up the message lastName is required, for both the
conditions;
whether the field firstName is empty or some text is inputted.

Is anything wrong in what I am doing?
Can anyone help me?


Thank in Advance,
 
Dinesh Samson J


-
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 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 property=address depends

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 property=address depends=requiredif
  arg0 key=label.prospect.address/
  var
var-namefield[0]/var-name
var-valueprospect/var-value
  /var
  var
var-namefield-test[0]/var-name
var-valueNULL/var-value
  /var
  var
var-namefield[1]/var-name
var-valueprospectNameOrId/var-value
  /var
  var
var-namefield-test[1]/var-name
var-valueNOTNULL/var-value
  /var
  var
var-namefield[2]/var-name
var-valueaction/var-value
  /var
  var
var-namefield-test[2]/var-name
var-valueNOTEQUAL/var-value
  /var
  var
var-namefield-value[2]/var-name
var-valueAdd Prospect/var-value
  /var
  var
var-namefield-join/var-name
var-valueAND/var-value
  /var
/field

Thanks,

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



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 property=address depends=requiredif
   arg0 key=label.prospect.address/
   var
 var-namefield[0]/var-name
 var-valueprospect/var-value
   /var
   var
 var-namefield-test[0]/var-name
 var-valueNULL/var-value
   /var
   var
 var-namefield[1]/var-name
 var-valueprospectNameOrId/var-value
   /var
   var
 var-namefield-test[1]/var-name
 var-valueNOTNULL/var-value
   /var
   var
 var-namefield[2]/var-name
 var-valueaction/var-value
   /var
   var
 var-namefield-test[2]/var-name
 var-valueNOTEQUAL/var-value
   /var
   var
 var-namefield-value[2]/var-name
 var-valueAdd Prospect/var-value
   /var
   var
 var-namefield-join/var-name
 var-valueAND/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]




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 property=address depends=requiredif
   arg0 key=label.prospect.address/
   var
 var-namefield[0]/var-name
 var-valueprospect/var-value
   /var
   var
 var-namefield-test[0]/var-name
 var-valueNULL/var-value
   /var
   var
 var-namefield[1]/var-name
 var-valueprospectNameOrId/var-value
   /var
   var
 var-namefield-test[1]/var-name
 var-valueNOTNULL/var-value
   /var
   var
 var-namefield[2]/var-name
 var-valueaction/var-value
   /var
   var
 var-namefield-test[2]/var-name
 var-valueNOTEQUAL/var-value
   /var
   var
 var-namefield-value[2]/var-name
 var-valueAdd Prospect/var-value
   /var
   var
 var-namefield-join/var-name
 var-valueAND/var-value
   /var
 /field
 
 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 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 property=address depends=requiredif
arg0 key=label.prospect.address/
var
  var-namefield[0]/var-name
  var-valueprospect/var-value
/var
var
  var-namefield-test[0]/var-name
  var-valueNULL/var-value
/var
var
  var-namefield[1]/var-name
  var-valueprospectNameOrId/var-value
/var
var
  var-namefield-test[1]/var-name
  var-valueNOTNULL/var-value
/var
var
  var-namefield[2]/var-name
  var-valueaction/var-value
/var
var
  var-namefield-test[2]/var-name
  var-valueNOTEQUAL/var-value
/var
var
  var-namefield-value[2]/var-name
  var-valueAdd Prospect/var-value
/var
var
  var-namefield-join/var-name
  var-valueAND/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]




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:
var
   var-nametest/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-namefield[0]/var-name
   var-valueprospect/var-value
 /var
 var
   var-namefield-test[0]/var-name
   var-valueNULL/var-value
 /var
 var
   var-namefield[1]/var-name
   var-valueprospectNameOrId/var-value
 /var
 var
   var-namefield-test[1]/var-name
   var-valueNOTNULL/var-value
 /var
 var
   var-namefield[2]/var-name
   var-valueaction/var-value
 /var
 var
   var-namefield-test[2]/var-name
   var-valueNOTEQUAL/var-value
 /var
 var
   var-namefield-value[2]/var-name
   var-valueAdd Prospect/var-value
 /var
 var
   var-namefield-join/var-name
   var-valueAND/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]




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: var
var-nametest/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-namefield[0]/var-name
var-valueprospect/var-value
  /var
  var
var-namefield-test[0]/var-name
var-valueNULL/var-value
  /var
  var
var-namefield[1]/var-name
var-valueprospectNameOrId/var-value
  /var
  var
var-namefield-test[1]/var-name
var-valueNOTNULL/var-value
  /var
  var
var-namefield[2]/var-name
var-valueaction/var-value
  /var
  var
var-namefield-test[2]/var-name
var-valueNOTEQUAL/var-value
  /var
  var
var-namefield-value[2]/var-name
var-valueAdd Prospect/var-value
  /var
  var
var-namefield-join/var-name
var-valueAND/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]
 
 

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

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 property=address depends=requiredif
   arg0 key=label.prospect.address/
   var
 var-namefield[0]/var-name
 var-valueprospect/var-value
   /var
   var
 var-namefield-test[0]/var-name
 var-valueNULL/var-value
   /var
   var
 var-namefield[1]/var-name
 var-valueprospectNameOrId/var-value
   /var
   var
 var-namefield-test[1]/var-name
 var-valueNOTNULL/var-value
   /var
   var
 var-namefield[2]/var-name
 var-valueaction/var-value
   /var
   var
 var-namefield-test[2]/var-name
 var-valueNOTEQUAL/var-value
   /var
   var
 var-namefield-value[2]/var-name
 var-valueAdd Prospect/var-value
   /var
   var
 var-namefield-join/var-name
 var-valueAND/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]



  validator name=andDependency
classname=org.glhec.fastadminas.util.StrutsValidator
   method=validateAndDependency
 methodParams=java.lang.Object,
   org.apache.commons.validator.ValidatorAction,
   org.apache.commons.validator.Field,
   org.apache.struts.action.ActionErrors,
   javax.servlet.http.HttpServletRequest
  msg=errors.andRequired

 javascript![CDATA[
function validateAndDependency(form) {
var bValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oDependant = new andDependency();
for (x in oDependant) {
if ((
((form[oDependant[x][0]].type == 'text' ||
  form[oDependant[x][0]].type == 'textarea' ||
  form[oDependant[x][0]].type == 'select-one' ||
  form[oDependant[x][0]].type == 'radio' ||
  form[oDependant[x][0]].type == 'password') 
  form[oDependant[x][0]].value != '') ||

((form[oDependant[x][2](secondField)].type == 'text' ||
  form[oDependant[x][2](secondField)].type == 'textarea

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 field tags) totally separate?  I mean, there's
no chance one of the other field 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 val 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 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 field tags) totally separate?  I 
 mean, there's no chance one of the other field 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 val 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:
 Dumb question: Are you sure you're running validations at all?

Yes.  I have some simple validations like: 
   field  property=newEmailAddress
depends=email 
arg0 key=label.additional.email/
   /field
and
   fieldproperty=date
   depends=required,date
 arg0 key=label.contact.date/
 var
   var-namedatePatternStrict/var-name
   var-valueMM/dd//var-value
 /var
   /field
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 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:
var
   var-nametest/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-namefield[0]/var-name
   var-valueprospect/var-value
 /var
 var
   var-namefield-test[0]/var-name
   var-valueNULL/var-value
 /var
 var
   var-namefield[1]/var-name
   var-valueprospectNameOrId/var-value
 /var
 var
   var-namefield-test[1]/var-name
   var-valueNOTNULL/var-value
 /var
 var
   var-namefield[2]/var-name
   var-valueaction/var-value
 /var
 var
   var-namefield-test[2]/var-name
   var-valueNOTEQUAL/var-value
 /var
 var
   var-namefield-value[2]/var-name
   var-valueAdd Prospect/var-value
 /var
 var
   var-namefield-join/var-name
   var-valueAND/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]


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




[VALIDATOR] requiredif ??

2003-01-29 Thread Wendy Smoak

James wrote:
 Check out the requiredif validator in 1.1b3

I have 1.1b3, I have the struts-validator webapp deployed, but the only
occurence of the text requiredif is in the validator-rules.xml file.  I
can't find an example of how to use it.  Can someone post a bit of their
validation.xml file to get me started, or point me towards some
documentation?

Thanks,

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



Where to send bugs/fixes (RequiredIf Equals Condition)

2003-01-27 Thread Weber, Jeremy
Where should I send bugs or fixes with common validator.  Specifically the
EQUAL condition in RequiredIf doesnt seem to do anything.  

if (dependTest.equals(FIELD_TEST_EQUAL)) {
this_required = dependTestValue.equalsIgnoreCase(dependVal);
}



Making it so, actually does the comparison

   if (dependTest.equals(FIELD_TEST_EQUAL)) {

this_required = dependTestValue.equalsIgnoreCase(dependVal);
String dependPropValue =
ValidatorUtil.getValueAsString(bean, dependProp);
if ( ! dependTestValue.equals( dependPropValue ) ){
   return false;
}
   }
   

Thanks, 

Jeremy Weber
[EMAIL PROTECTED]

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




Re: Where to send bugs/fixes (RequiredIf Equals Condition)

2003-01-27 Thread David Graham
Open a bug report for the issue and attach a patch file to it.

David







From: Weber, Jeremy [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: 'Struts Users Mailing List' (E-mail) [EMAIL PROTECTED]
Subject: Where to send bugs/fixes (RequiredIf Equals Condition)
Date: Mon, 27 Jan 2003 09:21:17 -0500

Where should I send bugs or fixes with common validator.  Specifically the
EQUAL condition in RequiredIf doesnt seem to do anything.

if (dependTest.equals(FIELD_TEST_EQUAL)) {
this_required = 
dependTestValue.equalsIgnoreCase(dependVal);
}



Making it so, actually does the comparison

   if (dependTest.equals(FIELD_TEST_EQUAL)) {

		this_required = dependTestValue.equalsIgnoreCase(dependVal);
		String dependPropValue =
ValidatorUtil.getValueAsString(bean, dependProp);
		if ( ! dependTestValue.equals( dependPropValue ) ){
		   return false;
		}
   }


Thanks,

Jeremy Weber
[EMAIL PROTECTED]

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


_
Protect your PC - get McAfee.com VirusScan Online  
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


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



RE: RequiredIf Example Request

2003-01-24 Thread Weber, Jeremy
Sorry I am not following you. I am trying to to use the 'requiredif'
validation not 'required' validation.  I dont have xml defining the field.
Just what I had posted in the previous message to illustrate my problem.  I
am currently looking at the code of requiredif to see if its functioning
properly.

You say to use required, mycheck.  But I cant require the field.  I need to
require it conditionally based on another field in the form.  That is why I
want to use requiredif.  Based on whether a field is true or false, validate
some other fields, kind of thing...

As for as the code for RequiredIf, it doesnt seem to me to handle EQUALS
well.  

boolean required = false;

...
...
...
if (dependTest.equals(FIELD_TEST_EQUAL)) {
this_required =
dependTestValue.equalsIgnoreCase(dependVal);
}
...
...

if (required) {
if ((value != null)  (value.length()  0)) {
return true;
} else {
errors.add(field.getKey(), Resources.getActionError(request,
va, field));
return false;
}
}
}
No where does it seem to compare the xml value and the value on the actual
form.




If you have any other suggestions or can clarify, please do...  


Jeremy Weber
[EMAIL PROTECTED]


-Original Message-
From: Dennis Muhlestein [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 24, 2003 3:39 PM
To: Struts Users Mailing List
Subject: RE: RequiredIf Example Request


I just barely ran into this problem.  Seems that all the field checks
are run.  Checking the Validator example (TowFieldCheck) in the struts
docs (1.1b3), It seems that if the value is null, you should let it pass
as accepted.

The xml defining the field is the one that should specify that the field
is required.  id: required,mycheck

Then it becomes possible to have an optional field.

-Dennis

On Thu, 2003-01-23 at 14:33, Weber, Jeremy wrote:
 Yes, but I would think that it would only be run after the first
validation
 (the requiredif) runs.  Is that not a correct assumption?  Do I need to
add
 anything to the exists validation to make it so?  In your example if the
 requiredif fails, does it still try to run the next validations?
 
 
 
 Jeremy Weber
 [EMAIL PROTECTED]
 
 
 -Original Message-
 From: Greg Murray [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, January 23, 2003 4:20 PM
 To: Struts Users Mailing List
 Subject: RE: RequiredIf Example Request
 
 
 I'm not sure exists is a standard validation rule.  Did you define it
 yourself?
 
 -Original Message-
 From: Weber, Jeremy [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, January 23, 2003 2:00 PM
 To: 'Struts Users Mailing List'
 Subject: RE: RequiredIf Example Request
 
 
 Thank you , thank you, thank you!
 
 I misspoke when I said checkboxs, its a radio button, like this...
 
   
 tr
   td class=mandatorybean:message
 key=appserver.usesecure.displayname//td
   tdhtml:radio property=useSecure value=true
 onclick=showSecureOptions('true');/ Yesbr
   html:radio property=useSecure value=false
 onclick=showSecureOptions('false');/ No/td
 
 /tr
 
field property=sslKeyStore
 depends=requiredif,exists
  arg0
 key=appserver.sslkeystore.displayname/
  var
   var-namefield[0]/var-name
   var-valueuseSecure/var-value
   /var
   var
   var-namefield-test[0]/var-name
   var-valueEQUAL/var-value
   /var
   var
   var-namefield-value[0]/var-name
   var-valuetrue/var-value
   /var
   /field
 
 
 From what I can tell, this looks like it will work... But it doesnt.
 However, this is the kicker... If I remove exists from depends, it acts as
 it should.  Now I figured that exists would only be called if requiredif
 passed.  Any thoughts?
 
 
 
 
 
 
 Jeremy Weber
 [EMAIL PROTECTED]
 
 
 -Original Message-
 From: Greg Murray [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, January 23, 2003 3:26 PM
 To: Struts Users Mailing List
 Subject: RE: RequiredIf Example Request
 
 
 If you're just requesting an example of something, here's what I'm
currently
 using:
 
   field property=studentId
 depends=requiredif,integer,minlength,maxlength
 msg name=requiredif key=errors.msg.studentIDorNameRequired/
 msg name=integer key=errors.msg.invalidStudentID/
 msg name=minlength key=errors.msg.invalidStudentID/
 msg name=maxlength key=errors.msg.invalidStudentID/
 var
   var-nameminlength/var-name
   var-value9/var

RE: RequiredIf Example Request

2003-01-24 Thread Dennis Muhlestein
I just barely ran into this problem.  Seems that all the field checks
are run.  Checking the Validator example (TowFieldCheck) in the struts
docs (1.1b3), It seems that if the value is null, you should let it pass
as accepted.

The xml defining the field is the one that should specify that the field
is required.  id: required,mycheck

Then it becomes possible to have an optional field.

-Dennis

On Thu, 2003-01-23 at 14:33, Weber, Jeremy wrote:
 Yes, but I would think that it would only be run after the first validation
 (the requiredif) runs.  Is that not a correct assumption?  Do I need to add
 anything to the exists validation to make it so?  In your example if the
 requiredif fails, does it still try to run the next validations?
 
 
 
 Jeremy Weber
 [EMAIL PROTECTED]
 
 
 -Original Message-
 From: Greg Murray [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, January 23, 2003 4:20 PM
 To: Struts Users Mailing List
 Subject: RE: RequiredIf Example Request
 
 
 I'm not sure exists is a standard validation rule.  Did you define it
 yourself?
 
 -Original Message-
 From: Weber, Jeremy [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, January 23, 2003 2:00 PM
 To: 'Struts Users Mailing List'
 Subject: RE: RequiredIf Example Request
 
 
 Thank you , thank you, thank you!
 
 I misspoke when I said checkboxs, its a radio button, like this...
 
   
 tr
   td class=mandatorybean:message
 key=appserver.usesecure.displayname//td
   tdhtml:radio property=useSecure value=true
 onclick=showSecureOptions('true');/ Yesbr
   html:radio property=useSecure value=false
 onclick=showSecureOptions('false');/ No/td
 
 /tr
 
field property=sslKeyStore
 depends=requiredif,exists
  arg0
 key=appserver.sslkeystore.displayname/
  var
   var-namefield[0]/var-name
   var-valueuseSecure/var-value
   /var
   var
   var-namefield-test[0]/var-name
   var-valueEQUAL/var-value
   /var
   var
   var-namefield-value[0]/var-name
   var-valuetrue/var-value
   /var
   /field
 
 
 From what I can tell, this looks like it will work... But it doesnt.
 However, this is the kicker... If I remove exists from depends, it acts as
 it should.  Now I figured that exists would only be called if requiredif
 passed.  Any thoughts?
 
 
 
 
 
 
 Jeremy Weber
 [EMAIL PROTECTED]
 
 
 -Original Message-
 From: Greg Murray [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, January 23, 2003 3:26 PM
 To: Struts Users Mailing List
 Subject: RE: RequiredIf Example Request
 
 
 If you're just requesting an example of something, here's what I'm currently
 using:
 
   field property=studentId
 depends=requiredif,integer,minlength,maxlength
 msg name=requiredif key=errors.msg.studentIDorNameRequired/
 msg name=integer key=errors.msg.invalidStudentID/
 msg name=minlength key=errors.msg.invalidStudentID/
 msg name=maxlength key=errors.msg.invalidStudentID/
 var
   var-nameminlength/var-name
   var-value9/var-value
 /var 
 var
   var-namemaxlength/var-name
   var-value9/var-value
 /var
 var
   var-namefield[0]/var-name
   var-valuelastName/var-value
 /var
 var
   var-namefield-test[0]/var-name
   var-valueNULL/var-value
 /var
   /field
 
 This makes studentId required if lastName is NULL.  If I also wanted to add
 a requirement to make studentId required if firstName was null, I'd add the
 following to the above:
 
 var
   var-namefield[1]/var-name
   var-valuelastName/var-value
 /var
 var
   var-namefield-test[1]/var-name
   var-valueNULL/var-value
 /var
 
 The conditions you can have are NULL, NOTNULL, and EQUAL.
 
 I haven't used this with checkboxes yet, but I think you'd probably have
 each of your three fields use requiredif, and use something like the
 following to make it depend on the checkbox:
 
 var
   var-namefield[0]/var-name
   var-valuecheckboxFieldName/var-value
 /var
 var
   var-namefield-test[0]/var-name
   var-valueNOTNULL/var-value
 /var
 
 The fact that the example was using indicies screwed me up for a while too
 until I took a look at the source code for FieldChecks.
 
 GM
 
 -Original Message-
 From: Weber, Jeremy [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, January 23, 2003 12:57 PM
 To: 'Struts Users Mailing List' (E-mail)
 Subject

RequiredIf Example Request

2003-01-23 Thread Weber, Jeremy
I requested this before and have not recieved a response...:(  Any takers
out there?  Currently I am having a heck of time figuring out how to make
this work...  

I have checked out all the online examples, but I am unclear as to what this
stuff means...

If you have this in your struts-config.xml...

form-bean
name=dependentlistForm
type=org.apache.struts.webapp.validator.forms.ValidatorForm
form-property
name=dependents
type=org.apache.struts.webapp.validator.Dependent[]
initial={'','','','','','','','','','',''}/
form-property
name=insureDependents
type=java.lang.Boolean
initial=false/
/form-bean

My form properties look like...

form-bean name=InstallConfigurationFormBean
type=com.vendorsite.install.beans.InstallConfigurationFormBean/


So I am missing the type and initial fields.  Can anybody help me see the
light?  I need a checkbox to control whether or not 3 addiotional text
fields are required.

Thanks,

Jeremy Weber
[EMAIL PROTECTED]

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




RE: RequiredIf Example Request

2003-01-23 Thread Greg Murray
If you're just requesting an example of something, here's what I'm currently using:

  field property=studentId depends=requiredif,integer,minlength,maxlength
msg name=requiredif key=errors.msg.studentIDorNameRequired/
msg name=integer key=errors.msg.invalidStudentID/
msg name=minlength key=errors.msg.invalidStudentID/
msg name=maxlength key=errors.msg.invalidStudentID/
var
  var-nameminlength/var-name
  var-value9/var-value
/var 
var
  var-namemaxlength/var-name
  var-value9/var-value
/var
var
  var-namefield[0]/var-name
  var-valuelastName/var-value
/var
var
  var-namefield-test[0]/var-name
  var-valueNULL/var-value
/var
  /field

This makes studentId required if lastName is NULL.  If I also wanted to add a 
requirement to make studentId required if firstName was null, I'd add the following to 
the above:

var
  var-namefield[1]/var-name
  var-valuelastName/var-value
/var
var
  var-namefield-test[1]/var-name
  var-valueNULL/var-value
/var

The conditions you can have are NULL, NOTNULL, and EQUAL.

I haven't used this with checkboxes yet, but I think you'd probably have each of your 
three fields use requiredif, and use something like the following to make it depend on 
the checkbox:

var
  var-namefield[0]/var-name
  var-valuecheckboxFieldName/var-value
/var
var
  var-namefield-test[0]/var-name
  var-valueNOTNULL/var-value
/var

The fact that the example was using indicies screwed me up for a while too until I 
took a look at the source code for FieldChecks.

GM

-Original Message-
From: Weber, Jeremy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 12:57 PM
To: 'Struts Users Mailing List' (E-mail)
Subject: RequiredIf Example Request


I requested this before and have not recieved a response...:(  Any takers
out there?  Currently I am having a heck of time figuring out how to make
this work...  

I have checked out all the online examples, but I am unclear as to what this
stuff means...

If you have this in your struts-config.xml...

form-bean
name=dependentlistForm
type=org.apache.struts.webapp.validator.forms.ValidatorForm
form-property
name=dependents
type=org.apache.struts.webapp.validator.Dependent[]
initial={'','','','','','','','','','',''}/
form-property
name=insureDependents
type=java.lang.Boolean
initial=false/
/form-bean

My form properties look like...

form-bean name=InstallConfigurationFormBean
type=com.vendorsite.install.beans.InstallConfigurationFormBean/


So I am missing the type and initial fields.  Can anybody help me see the
light?  I need a checkbox to control whether or not 3 addiotional text
fields are required.

Thanks,

Jeremy Weber
[EMAIL PROTECTED]

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


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




RE: RequiredIf Example Request

2003-01-23 Thread Weber, Jeremy
Thank you , thank you, thank you!

I misspoke when I said checkboxs, its a radio button, like this...


tr
td class=mandatorybean:message
key=appserver.usesecure.displayname//td
tdhtml:radio property=useSecure value=true
onclick=showSecureOptions('true');/ Yesbr
html:radio property=useSecure value=false
onclick=showSecureOptions('false');/ No/td

/tr

 field property=sslKeyStore
depends=requiredif,exists
   arg0
key=appserver.sslkeystore.displayname/
   var
var-namefield[0]/var-name
var-valueuseSecure/var-value
/var
var
var-namefield-test[0]/var-name
var-valueEQUAL/var-value
/var
var
var-namefield-value[0]/var-name
var-valuetrue/var-value
/var
/field


From what I can tell, this looks like it will work... But it doesnt.
However, this is the kicker... If I remove exists from depends, it acts as
it should.  Now I figured that exists would only be called if requiredif
passed.  Any thoughts?






Jeremy Weber
[EMAIL PROTECTED]


-Original Message-
From: Greg Murray [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 3:26 PM
To: Struts Users Mailing List
Subject: RE: RequiredIf Example Request


If you're just requesting an example of something, here's what I'm currently
using:

  field property=studentId
depends=requiredif,integer,minlength,maxlength
msg name=requiredif key=errors.msg.studentIDorNameRequired/
msg name=integer key=errors.msg.invalidStudentID/
msg name=minlength key=errors.msg.invalidStudentID/
msg name=maxlength key=errors.msg.invalidStudentID/
var
  var-nameminlength/var-name
  var-value9/var-value
/var 
var
  var-namemaxlength/var-name
  var-value9/var-value
/var
var
  var-namefield[0]/var-name
  var-valuelastName/var-value
/var
var
  var-namefield-test[0]/var-name
  var-valueNULL/var-value
/var
  /field

This makes studentId required if lastName is NULL.  If I also wanted to add
a requirement to make studentId required if firstName was null, I'd add the
following to the above:

var
  var-namefield[1]/var-name
  var-valuelastName/var-value
/var
var
  var-namefield-test[1]/var-name
  var-valueNULL/var-value
/var

The conditions you can have are NULL, NOTNULL, and EQUAL.

I haven't used this with checkboxes yet, but I think you'd probably have
each of your three fields use requiredif, and use something like the
following to make it depend on the checkbox:

var
  var-namefield[0]/var-name
  var-valuecheckboxFieldName/var-value
/var
var
  var-namefield-test[0]/var-name
  var-valueNOTNULL/var-value
/var

The fact that the example was using indicies screwed me up for a while too
until I took a look at the source code for FieldChecks.

GM

-Original Message-
From: Weber, Jeremy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 12:57 PM
To: 'Struts Users Mailing List' (E-mail)
Subject: RequiredIf Example Request


I requested this before and have not recieved a response...:(  Any takers
out there?  Currently I am having a heck of time figuring out how to make
this work...  

I have checked out all the online examples, but I am unclear as to what this
stuff means...

If you have this in your struts-config.xml...

form-bean
name=dependentlistForm
type=org.apache.struts.webapp.validator.forms.ValidatorForm
form-property
name=dependents
type=org.apache.struts.webapp.validator.Dependent[]
initial={'','','','','','','','','','',''}/
form-property
name=insureDependents
type=java.lang.Boolean
initial=false/
/form-bean

My form properties look like...

form-bean name=InstallConfigurationFormBean
type=com.vendorsite.install.beans.InstallConfigurationFormBean/


So I am missing the type and initial fields.  Can anybody help me see the
light?  I need a checkbox to control whether or not 3 addiotional text
fields are required.

Thanks,

Jeremy Weber
[EMAIL PROTECTED]

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


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

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED

RE: RequiredIf Example Request

2003-01-23 Thread Greg Murray
I'm not sure exists is a standard validation rule.  Did you define it yourself?

-Original Message-
From: Weber, Jeremy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 2:00 PM
To: 'Struts Users Mailing List'
Subject: RE: RequiredIf Example Request


Thank you , thank you, thank you!

I misspoke when I said checkboxs, its a radio button, like this...


tr
td class=mandatorybean:message
key=appserver.usesecure.displayname//td
tdhtml:radio property=useSecure value=true
onclick=showSecureOptions('true');/ Yesbr
html:radio property=useSecure value=false
onclick=showSecureOptions('false');/ No/td

/tr

 field property=sslKeyStore
depends=requiredif,exists
   arg0
key=appserver.sslkeystore.displayname/
   var
var-namefield[0]/var-name
var-valueuseSecure/var-value
/var
var
var-namefield-test[0]/var-name
var-valueEQUAL/var-value
/var
var
var-namefield-value[0]/var-name
var-valuetrue/var-value
/var
/field


From what I can tell, this looks like it will work... But it doesnt.
However, this is the kicker... If I remove exists from depends, it acts as
it should.  Now I figured that exists would only be called if requiredif
passed.  Any thoughts?






Jeremy Weber
[EMAIL PROTECTED]


-Original Message-
From: Greg Murray [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 3:26 PM
To: Struts Users Mailing List
Subject: RE: RequiredIf Example Request


If you're just requesting an example of something, here's what I'm currently
using:

  field property=studentId
depends=requiredif,integer,minlength,maxlength
msg name=requiredif key=errors.msg.studentIDorNameRequired/
msg name=integer key=errors.msg.invalidStudentID/
msg name=minlength key=errors.msg.invalidStudentID/
msg name=maxlength key=errors.msg.invalidStudentID/
var
  var-nameminlength/var-name
  var-value9/var-value
/var 
var
  var-namemaxlength/var-name
  var-value9/var-value
/var
var
  var-namefield[0]/var-name
  var-valuelastName/var-value
/var
var
  var-namefield-test[0]/var-name
  var-valueNULL/var-value
/var
  /field

This makes studentId required if lastName is NULL.  If I also wanted to add
a requirement to make studentId required if firstName was null, I'd add the
following to the above:

var
  var-namefield[1]/var-name
  var-valuelastName/var-value
/var
var
  var-namefield-test[1]/var-name
  var-valueNULL/var-value
/var

The conditions you can have are NULL, NOTNULL, and EQUAL.

I haven't used this with checkboxes yet, but I think you'd probably have
each of your three fields use requiredif, and use something like the
following to make it depend on the checkbox:

var
  var-namefield[0]/var-name
  var-valuecheckboxFieldName/var-value
/var
var
  var-namefield-test[0]/var-name
  var-valueNOTNULL/var-value
/var

The fact that the example was using indicies screwed me up for a while too
until I took a look at the source code for FieldChecks.

GM

-Original Message-
From: Weber, Jeremy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 12:57 PM
To: 'Struts Users Mailing List' (E-mail)
Subject: RequiredIf Example Request


I requested this before and have not recieved a response...:(  Any takers
out there?  Currently I am having a heck of time figuring out how to make
this work...  

I have checked out all the online examples, but I am unclear as to what this
stuff means...

If you have this in your struts-config.xml...

form-bean
name=dependentlistForm
type=org.apache.struts.webapp.validator.forms.ValidatorForm
form-property
name=dependents
type=org.apache.struts.webapp.validator.Dependent[]
initial={'','','','','','','','','','',''}/
form-property
name=insureDependents
type=java.lang.Boolean
initial=false/
/form-bean

My form properties look like...

form-bean name=InstallConfigurationFormBean
type=com.vendorsite.install.beans.InstallConfigurationFormBean/


So I am missing the type and initial fields.  Can anybody help me see the
light?  I need a checkbox to control whether or not 3 addiotional text
fields are required.

Thanks,

Jeremy Weber
[EMAIL PROTECTED]

--
To unsubscribe

RE: RequiredIf Example Request

2003-01-23 Thread Weber, Jeremy
Yes, but I would think that it would only be run after the first validation
(the requiredif) runs.  Is that not a correct assumption?  Do I need to add
anything to the exists validation to make it so?  In your example if the
requiredif fails, does it still try to run the next validations?



Jeremy Weber
[EMAIL PROTECTED]


-Original Message-
From: Greg Murray [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 4:20 PM
To: Struts Users Mailing List
Subject: RE: RequiredIf Example Request


I'm not sure exists is a standard validation rule.  Did you define it
yourself?

-Original Message-
From: Weber, Jeremy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 2:00 PM
To: 'Struts Users Mailing List'
Subject: RE: RequiredIf Example Request


Thank you , thank you, thank you!

I misspoke when I said checkboxs, its a radio button, like this...


tr
td class=mandatorybean:message
key=appserver.usesecure.displayname//td
tdhtml:radio property=useSecure value=true
onclick=showSecureOptions('true');/ Yesbr
html:radio property=useSecure value=false
onclick=showSecureOptions('false');/ No/td

/tr

 field property=sslKeyStore
depends=requiredif,exists
   arg0
key=appserver.sslkeystore.displayname/
   var
var-namefield[0]/var-name
var-valueuseSecure/var-value
/var
var
var-namefield-test[0]/var-name
var-valueEQUAL/var-value
/var
var
var-namefield-value[0]/var-name
var-valuetrue/var-value
/var
/field


From what I can tell, this looks like it will work... But it doesnt.
However, this is the kicker... If I remove exists from depends, it acts as
it should.  Now I figured that exists would only be called if requiredif
passed.  Any thoughts?






Jeremy Weber
[EMAIL PROTECTED]


-Original Message-
From: Greg Murray [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 3:26 PM
To: Struts Users Mailing List
Subject: RE: RequiredIf Example Request


If you're just requesting an example of something, here's what I'm currently
using:

  field property=studentId
depends=requiredif,integer,minlength,maxlength
msg name=requiredif key=errors.msg.studentIDorNameRequired/
msg name=integer key=errors.msg.invalidStudentID/
msg name=minlength key=errors.msg.invalidStudentID/
msg name=maxlength key=errors.msg.invalidStudentID/
var
  var-nameminlength/var-name
  var-value9/var-value
/var 
var
  var-namemaxlength/var-name
  var-value9/var-value
/var
var
  var-namefield[0]/var-name
  var-valuelastName/var-value
/var
var
  var-namefield-test[0]/var-name
  var-valueNULL/var-value
/var
  /field

This makes studentId required if lastName is NULL.  If I also wanted to add
a requirement to make studentId required if firstName was null, I'd add the
following to the above:

var
  var-namefield[1]/var-name
  var-valuelastName/var-value
/var
var
  var-namefield-test[1]/var-name
  var-valueNULL/var-value
/var

The conditions you can have are NULL, NOTNULL, and EQUAL.

I haven't used this with checkboxes yet, but I think you'd probably have
each of your three fields use requiredif, and use something like the
following to make it depend on the checkbox:

var
  var-namefield[0]/var-name
  var-valuecheckboxFieldName/var-value
/var
var
  var-namefield-test[0]/var-name
  var-valueNOTNULL/var-value
/var

The fact that the example was using indicies screwed me up for a while too
until I took a look at the source code for FieldChecks.

GM

-Original Message-
From: Weber, Jeremy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 12:57 PM
To: 'Struts Users Mailing List' (E-mail)
Subject: RequiredIf Example Request


I requested this before and have not recieved a response...:(  Any takers
out there?  Currently I am having a heck of time figuring out how to make
this work...  

I have checked out all the online examples, but I am unclear as to what this
stuff means...

If you have this in your struts-config.xml...

form-bean
name=dependentlistForm
type=org.apache.struts.webapp.validator.forms.ValidatorForm
form-property
name=dependents
type=org.apache.struts.webapp.validator.Dependent[]
initial

  1   2   >