http://jakarta.apache.org/struts/userGuide/dev_validator.html

may help. Look for twofield example.

-D
----- Original Message ----- 
From: "Joey Ebright" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 20, 2003 10:54 PM
Subject: Validation - Require One of Multiple Fields


> Hello,
> 
> I am looking for a way to validate that the user filled in at least one 
> field of a possible many fields.  These fields represent search criteria 
> to use for constructing an SQL query to a database and I want to ensure 
> the user gives me at least one item to search on...
> 
> I looked at the requiredif validator but it is only server-side and I 
> want both client side and server side validation.  If  I just wanted 
> server side I could have written the validation code in my ActionForm 
> myself...
> 
> I did come up with some rudimentary JavaScript to do this but am lost at 
> how to do this in the same manner in a generic fashion on the server 
> side.  The elegant approach of the validator framework on the client 
> side is that it passes an array of fields that are to be validated and 
> the validate method is only called once.  This allowed me in my 
> JavaScript to just see if the addition of all the fields put together 
> equaled an empty string.  On the server side, the framework differs in 
> its approach to validation of fields and each field to be validated 
> calls the validating method once.  Hence without reworking the validator 
> framework, the same approach cannot be used - unless of course I am 
> mistaken.  
> 
> Anyone else got some ideas out there???
> 
> TIA,
> Joey
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

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

Reply via email to