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

Steffen Ritter info at rs-websystems.de
Fri Jul 30 11:45:43 CEST 2010


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


More information about the TYPO3-project-typo3v4mvc mailing list