validate String[]

2003-06-19 Thread Ben Anderson
I have a page with multiple checkboxes (I'm using ) and I 
need to validate that at least one of them is checked.


  
  


  
  

This doesn't seem to work.  I've been reading through Struts Chapter 12 pdf 
about validation, but can't seem to find any cases where the property is an 
array of Strings.  Any thoughts?
Thanks in advance,
Ben Anderson

_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


Re: validate String[]

2003-06-19 Thread ara
Hi,Ben.

I think "required"(and others also) is work only String,
not array.
I was same situation, so I made a class that...


public class InputChecks extends FieldChecks {
public static boolean validateRequiredArray(Object
bean,
   ValidatorAction
va, Field field,
   ActionErrors
errors,
  
HttpServletRequest request) {

String[] values = (String[])bean;

for (int i=0;i
  



This work all item in array.
But, I don't know that is best way...

- Original Message - 
From: "Ben Anderson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 19, 2003 9:17 PM
Subject: validate String[]


> I have a page with multiple checkboxes (I'm using
) and I 
> need to validate that at least one of them is checked.
> 
> 
>name="reportForm"
>   
type="org.apache.struts.validator.DynaValidatorActionForm">
>
> 
> 
> 
>
>
> 
> 
> This doesn't seem to work.  I've been reading through
Struts Chapter 12 pdf 
> about validation, but can't seem to find any cases where
the property is an 
> array of Strings.  Any thoughts?
> Thanks in advance,
> Ben Anderson
> 
>
_
> STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
 
> http://join.msn.com/?page=features/junkmail
> 
> 
>
-
> To unsubscribe, e-mail:
[EMAIL PROTECTED]
> For additional commands, e-mail:
[EMAIL PROTECTED]
> 

__
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!  http://bb.yahoo.co.jp/


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