[TYPO3-50-general] optional or nested validators

Denyer Ec denyerec at gmail.com
Fri Oct 9 09:41:44 CEST 2009


I recently ran up against the same problem in a form where if the user
enters something into the password field, the password is validated
and updated, but if they leave it blank it is not used. Similarly
interested to hear of the approach!

Kind regards,
Denyer

On Thu, Oct 8, 2009 at 5:58 PM, Pascal Jungblut
<mail at pascal-jungblut.com> wrote:
> Hello,
>
> I'm curious about the validation feature. Let's assume I have an
> optional field in fe_users (e.g. 'zip'). I want the user to enter
> either nothing _or_ a five-digit number. As I see it, there is
> currently no possibility to use the DisjunctionValidator that would
> allow something like:
>
> ---
> @validate Empty, StringLength(minimum = 5, maximum = 5)
> ---
>
> So if I think one step further I would want to combine the
> DisjunctionValidator and ConjunctionValidator or even nest them:
>
> ---
> @validate OR(Empty, AND(String, StringLength(minimum = 3, maximum = 5)))
> ---
>
> Of course, I could write a new validator for that but it would reduce
> code-redundancy if one were able to nest the validators.
>
> Is this already possible? If not: how would you validate something
> that is optional?
> I'd like to implement the nested-feature but I don't know if you like
> the idea.
>
> Regards
> Pascal
> _______________________________________________
> TYPO3-project-5_0-general mailing list
> TYPO3-project-5_0-general at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-5_0-general
>



-- 
-------
http://gallery.denyerec.co.uk


More information about the TYPO3-project-5_0-general mailing list