[html-formfu] Re: Date Element

Carl Franks fireartist at gmail.com
Thu Aug 9 13:08:37 GMT 2007


On 07/08/07, Tobias Kremer <list at funkreich.de> wrote:
> > How were you testing this?
> >
> > The file "t/elements/date.t" tests the Required constraint on a date
> > element - it seems to work ok.
>
> Can you give the attached Catalyst app a spin? It marks the field as "Field is
> required" even if a valid date is entered.

ok, I've checked in a fix for this - it should be working now.

> > In this case, date::process() will set the date value to be the
> > strftime() value - such as '%d-%m-%Y' - to ensure that there's a true
> > value to satisfy any Required constraint, and to further ensure the
> > DateTime inflator will return an error.
>
> Hmm ... Is the inflator run not until after the form is filled out correctly? If
> so, an invalid date won't be tagged as invalid, will it?

Each different processing step (constraint, inflator, validator,
transformer) is only run if the preceding step ran with no errors.

If an invalid date is entered, date::process() fills the date as
'%d-%m-%Y' to ensure it passes any Required constraint, but fails the
Inflator.

Another option is to add a DateTime constraint, rather than the
Inflator - I've written one but not checked it in yet.

Carl



More information about the HTML-FormFu mailing list