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]