Struts Validator to validate *optional* date fields?

M

Marcus Leon

Does anyone know how to use the Struts Validator to validate dates on
*optional* fields?

The Validator validates dates fine but it always returns an
ActionError if the field is empty.

We would like to ensure that any entered date is valid but not enforce
the user to enter a date.

We tried removing the depends="required" from validator-rules.xml but
the problem remains.

Does anyone have any ideas?

Thanks
 
M

Marcus Leon

One add'l note. It seems it is possible to validate optional integer
and long fields. Just not dates.

With numeric, the Validator does not create a requierd error if the
field is empty. If the field is not empty, and is not the correct
numeric type, than an invalid data type error is created. This is the
functionality we want.

Not sure why dates are different. Also weird as the numeric rules in
validator-rules.xml depend on required.

-Marcus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top