I think the requiredIf is still your best bet. I think based on other recent posts,
that the variable names have been changed to support javascript, but that code
may still be up to you to write.


-jeff

On Saturday, March 22, 2003, at 09:11 PM, Joey Ebright wrote:

Thanks, but that is for making sure two fields are the same - I have mastered that one...

What I am after is making sure at least 1 of a group of fields has a value filled in. I don't care which one so long as at least one field is filled in...

Dan Tran wrote:

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]






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



Reply via email to