[TYPO3-mvc] Validation of non-mandatory DateTime fields
François Suter
fsu-lists at cobweb.ch
Wed Apr 13 11:19:46 CEST 2011
Any input on this?
> 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?
--
Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch
More information about the TYPO3-project-typo3v4mvc
mailing list