# Struts: Validate two fields at once

Please help me out solving my problem, I am new with struts and I have a problem that I can"t seem to fix.

I have two fields that are required, but I cannot recieve two error messages in case that they are both empty. The only message that must show up is "please insert the date interval", regardless of wich one is empty(or, if they are both empty).

I"m using validation.xml, Struts version 1.3

The validation of two or more fields too easy if you use ValidatorForm and validate method.

To use declarative custom validator you need to read this reference guide that has links and example of custom validator to validate two fields.

This is an example of how you could compare two fields to see if they have the same value. A good example of this is when you are validating a user changing their password and there is the main password field and a confirmation field.