Struts Validator to validate *optional* date fields?

Discussion in 'Java' started by Marcus Leon, Jun 28, 2003.

  1. Marcus Leon

    Marcus Leon Guest

    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
    Marcus Leon, Jun 28, 2003
    #1
    1. Advertising

  2. Marcus Leon

    Marcus Leon Guest

    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

    (Marcus Leon) wrote in message news:<>...
    > 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
    Marcus Leon, Jun 30, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Grey
    Replies:
    3
    Views:
    13,654
    grish
    Oct 9, 2012
  2. Fernando Lopes
    Replies:
    2
    Views:
    553
    Peter Blum
    Nov 19, 2004
  3. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,244
    Michael Borgwardt
    May 30, 2004
  4. Replies:
    4
    Views:
    893
    Richter~9.6
    Feb 13, 2007
  5. Shailesh Katti

    compare validator to validate date in user control

    Shailesh Katti, Jul 27, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    701
    Teemu Keiski
    Jul 28, 2003
Loading...

Share This Page