[TYPO3-mvc] valide field only if there is value in it?

Daniel Dimitrov danielsd_bg at yahoo.fr
Fri Jul 30 11:50:35 CEST 2010


Hey Steffen,

"Steffen Ritter" <info at rs-websystems.de> wrote in message 
news:mailman.1.1280483452.21015.typo3-project-typo3v4mvc at lists.typo3.org...
> Am 30.07.2010 11:42, schrieb Daniel Dimitrov:
>> Hey guys,
>> I'm wondering if it is possible to use the
>> @validate EmailAddress
>>
>> only if the field has a value in it?
>>
>> If the user fills a value in the form field email, then I want to
>> validate if it is a valid email address. If the user leaves the field
>> empty I don't want to output an error message.
>>
>> Should I write my own validators??
>> Daniel
> just do your own wrapper, extend EmailAddressValidator,
>
> if(is_empty($value)) {
> return TRUE;
> } else {
> return parent::isValid($value);
> }
>
> reagrds
>
> Steffen

thanks!
Daniel 



More information about the TYPO3-project-typo3v4mvc mailing list