[TYPO3-project-formidable] Conditional validators ?
Jerome Schneider
typo3dev at ameos.com
Fri Sep 1 19:37:25 CEST 2006
Hello list !
In future version 0.6.0 it will be possible to define a validatior using a
userobj.
Example :
<renderlet:TEXT name="breast" label="How huge is you breast ?">
<validators>
<validator:STANDARD>
<userobj>
<php><![CDATA[
$aData = $this->oDataHandler->getFormData(); // get
the submitted data
if($aData["sex"] == "female") {
return !empty($aData["breast"]); // return true
if set, false if empty
} else {
return true; // always valid if it's a male
}
]]></php>
</userobj>
<message>Breast size is required, lady !</message>
</validator:STANDARD>
</validators>
</renderlet:TEXT>
And François is right, you could also have used a modifier to alter the
shape of your XML during xml-precompilation ( ie, simply remove the "breast"
rdt from the config before processing it )
We're working so hard to make things ever better. We're going to release
this 0.6.0 version including huge improvements soon.
Namely :
* Better handling of userobj ( php script in XML, ability to make
typoscript userobj, ... )
* Better performances ( some basic cahinbg layer has been implemented )
* Server events ( NEW, sort of, just as things are done in .net to
automaticaly handle user interactions ^^ ; really useful ! )
* Multichannel rendering : NEW ;
now renderlets don't just render a single string of HTML. They
still render this HTML, but many other things, depending on the rdt.
For instance : say we have a FILE renderlet, named "myimage",
managing the upload of images in your form ; in your templates, you can use
:
-> {myimage} => as usual, full HTML string
produced by the rdt, including label, input field, link to the image, ...
all in the same string
-> {myimage.imagetag} => only the <IMG src="..." /> tag
of the uploaded image
-> {myimage.filepath} => the full web filepath of this
file
-> {myimage.filepath.rel} => the relative filepath of this
file
-> and many more ...
This is a major improvement in the flexibility of formidable :
you can now "recombine" HTML parts to fit your needs if the standard
rendering of the renderlet don't .
* Ability to reprocess HTML at runtime using Typoscript ( if combined to
multichannel template, really powerful !!)
* Much better debug of what's going on in your form.
* A great abstraction layer for javascript to manage client events in a
cross browser way
* Ability to tell formidable that your form is in
-> draft mode ( bypasses validation and save despite the errors )
-> test mode ( just executes the validators, but don't save to
database )
* Ability to alter the way the lister builds it's SQL request to fetch
search results
* and much more ( i can't remember ^^ )
By the way, we presented formidable at the T3DD06 ( typo3 days ) and people
were really enthousiastic ^^
Cheers, dear users !
There and back again, Jerome
"FS" <fs.nospam1 at a-e-r.org> a écrit dans le message de news:
mailman.315.1157126945.26582.typo3-project-formidable at lists.netfielders.de...
If you play with the <modifiers>, you can do what you want.
-> the modifier will modify the validator if the field is or not blank.
--
F. SCHOSSIG, ICT Manager
Assemblée des Régions d'Europe
http://www.a-e-r.org
Le 1 sept. 06 à 17:45, Jérémy Lecour a écrit :
> Hi,
>
> Is it possible to have some conditions applied to validators ?
> I'd like to set a field as mandatory only if another one is blank.
>
> Another way to do this would be to permit userobj in validators. A
> specific function could be lanched and checked to see if true or false
> is returned to determine if the validation is passed or not.
>
> I hope that something like that could become real soon ;-)
>
> Thanks
>
> -- Jérémy Lecour : <mailto:jeremy.lecour at gmail.com>
> webdesigner, webmaster et développeur web
> Trésorier du PLUG : Provence Linux User Group
> http://www.plugfr.org/
> _______________________________________________
> TYPO3-project-formidable mailing list
> TYPO3-project-formidable at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-
> formidable
More information about the TYPO3-project-formidable
mailing list