struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Kyser <>
Subject Re: [Validator] Conditional Validations
Date Sat, 01 Mar 2003 12:33:13 GMT
Hi Amit,

I haven't tried this, so it is total speculation, but I wonder if you
could put a hidden field on the form, and use just one
'requiredif' rule for it, only "requiring" it when the others
were NULL.

Since the resource message would be:

	errors.required={0} is a required field.

you'd need a message resource that was something like

	"At least one of name, date, foo, bar, grill"

for the message presented to the user to make sense.

(Then, of course, you'd still have the separate
type-specific depends for each of the individual fields).

If that didn;t work, I suppose you could use the 'requiredif' rule
for each of the 5-6 input fields, requiring a given field if ALL the
others were NULL. If you did that for all 6, it should generate the
correct check, but you'd be glad you didn't have 10-12 search
fields when you got through setting it up that way :)



On Friday, February 28, 2003, at 03:55  AM, Amit Keshav Kulkarni wrote:

> Hi All,
> I need to Validate the inputs on a Search Page
> I have 5-6 input fields for Seach Criteria
> I have to validate that at least one field has to be not null
> and if some value is entered in a field, it should be validated..
> Say, numeric or alphanumeric fields.
> How can I set up my validation.xml in such a case?
> Thanks and regards,
> Amit
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message