[TYPO3-project-formidable] Validation against other input
Jerome Schneider
typo3dev at ameos.com
Thu Apr 2 08:51:42 CEST 2009
Hi Uwe,
You might want to try the so-called 'userobj' validator
Luc Muller once wrote a snippet presenting it here, at the bottom of the
page: http://formidable.typo3.ug/pastebin/snippet/28.html
Regards,
Jerome
Uwe Grohne a écrit :
> Hi,
>
> I want to validate in the seminars extension, that the number of seats
> selected in the registration form is equal to the count of lines in the
> textarea for the attendees, so that I know, that the registering person
> entered as many persons as seats were reserved. I didn't find any hint
> on how to do this, cause I think, I will have to combine a custom PHP
> validator with another value. Any ideas on this?
>
> This is the original part of the file:
>
> <renderlet:LISTBOX name="seats">
> <data>
> <items>
> <item value="1" caption="1" />
> <item value="2" caption="2" />
> <item value="3" caption="3" />
> <item value="4" caption="4" />
> <item value="5" caption="5" />
> </items>
> <defaultvalue>1</defaultvalue>
> </data>
> <validators>
> <validator:PREG>
> <pattern>
> <value>/^[\d]*$/</value>
>
> <message>LLL:EXT:seminars/pi1/locallang.xml:message_noSeatsNumber</message>
> </pattern>
> </validator:PREG>
> <validator:STANDARD>
> <userobj>
> <extension>this</extension>
> <method>canRegisterSeats</method>
>
> <message>LLL:EXT:seminars/pi1/locallang.xml:message_invalidNumberOfSeats</message>
>
> </userobj>
> </validator:STANDARD>
> </validators>
> <process>
> <userobj>
> <extension>this</extension>
> <method>hasRegistrationFormField</method>
> <params>
> <data name="elementname" value="seats" />
> </params>
> </userobj>
> </process>
> </renderlet:LISTBOX>
>
> <renderlet:TEXTAREA name="attendees_names">
> <validators>
> <validator:STANDARD>
> <userobj>
> <extension>this</extension>
> <method>hasAttendeesNames</method>
>
> <message>LLL:EXT:seminars/pi1/locallang.xml:message_provideAttendeesNames</message>
>
> </userobj>
> </validator:STANDARD>
> </validators>
> <process>
> <userobj>
> <extension>this</extension>
> <method>hasRegistrationFormField</method>
> <params>
> <data name="elementname" value="attendees_names" />
> </params>
> </userobj>
> </process>
> </renderlet:TEXTAREA>
>
> Thanks in advance!
More information about the TYPO3-project-formidable
mailing list