[TYPO3-50-general] optional or nested validators
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!
On Thu, Oct 8, 2009 at 5:58 PM, Pascal Jungblut
<mail at pascal-jungblut.com> wrote:
> 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.
> TYPO3-project-5_0-general mailing list
> TYPO3-project-5_0-general at lists.netfielders.de
More information about the TYPO3-project-5_0-general