[TYPO3-mvc] Validation of non-mandatory DateTime fields
François Suter
fsu-lists at cobweb.ch
Tue Apr 26 09:53:34 CEST 2011
Ping again. Any input on this topic?
> Hi all,
>
> I stumbled on a weird behavior of the DateTime data type. Assuming I
> declare a property as having to validate as a DateTime object, i.e.
>
> /**
> * Date and time of the doctor's examination
> *
> * @var DateTime $doctorDate
> * @validate DateTime
> */
> protected $doctorDate;
>
> If the date is wrong upon input (say somebody entered "xxxx"), I'll get
> a validation error and the input form gets reloaded with an empty value
> in the Date field. That's fine.
>
> However if I leave the field empty (which is supposed to be fine,
> because it's not mandatory) and the form gets reloaded because of some
> other input error, the field is now filled with the current date, which
> is not desirable. At which point in the process was the current date
> "injected" into my property? Is there any way to prevent this?
>
> Cheers
--
Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch
More information about the TYPO3-project-typo3v4mvc
mailing list