[TYPO3-mvc] validator: email, but not required?

Patrick Schriner patrick.schriner at diemedialen.de
Tue Feb 21 18:54:31 CET 2012


Hi,

I had this problem recently, and at that time did not think of the obvious  
solution:

Don't validate the e-mail field by itself, but validate the model with a  
model validator.

The only drawback might be (I haven't tested this) that the model  
validator might be called only if the property validators report as valid.

Reference:  
http://docs.typo3incubator.org/ExtbaseFluidBook/_build/html/9-CrosscuttingConcerns/2-validating-domain-objects.html

On Tue, 21 Feb 2012 18:01:01 +0100, Stig Nørgaard Færch <snf at dkm.dk> wrote:

> If I validate a property as e-mail, it will also fail an empty value. It  
> of course makes some sense, as an empty value doesn't comply as an  
> e-mail address.
>
> But I need it to pass when empty as well. What is the preferred to do  
> this way?
>
> /Stig

--
Patrick Schriner


More information about the TYPO3-project-typo3v4mvc mailing list