[TYPO3-mvc] Validation for EmailAddress called when nothing is filled in, not required property

Henjo Hoeksma me at henjohoeksma.nl
Thu Jul 14 17:13:27 CEST 2011


On 2011-07-14 16:55:14 +0200, Bastian Waidelich said:

> Henjo Hoeksma wrote:
> 
> Hi,
> 
>> Yeah, that would be possible. But it doesn't make sense: I have not
>> stated the property to be required. So, empty should be allowed default.
> 
> You have stated that the property must be a valid email address. An 
> empty string is no valid email address. So this could be logical too.
> But of course you're right, this should be possible and is already 
> planned. There is already a conjunction and disjunction validator that 
> could be used to logically combine multiple validators (via AND/OR). 
> The part that's missing is the format of the annotation.. If you have 
> an idea, feel free to share it.
> 
> Best,
> Bastian

Hi Bastian,

I noticed the conjunction/disjunction validators. Is there any more 
docu or threads on how to use them?
For now, I will probably write an altered email validator.
I agree both are logical, but it would be more logical if an empty 
result would only be validated when combined with a notEmpty.

I would suggest the following for non required email addresses:

@validate EmailAddress

And for required email addresses:

@validate NotEmpty,EmailAddress

and/or:

@validate EmailAddress,NotEmpty

Thanks for your thoughts.

Henjo



More information about the TYPO3-project-typo3v4mvc mailing list