Am 19.08.2008 um 13:59 schrieb Van Daele, Koen:

> Hi,
>
> Thanks for the info, was very useful.
>
> Just some more things about validation:
> - it seem I can't trim a string, or at least when I add trim="true"  
> to a validator I get a config validation exception (under 0.11.2).  
> The file 
> http://trac.agavi.org/browser/branches/0.11/src/config/xsd/validators.xsd 
>  seems to be missing the trim attribute?

<parameter name="trim">true</parameter>


> - About the various validation modes, is this correct?:
>       * Relaxed: all parameters stay available

regardless of their validation result, correct


>       * Conditional: all parameters are available unless validation of  
> any parameter fails, then only the parameters that pass validation  
> and have a validator defined are available? At first I thought that  
> when one validator failed only the failed parameter would be  
> removed, but it seems that anything that does not have a validator  
> is also removed.

incorrect. conditional mode is identical to relaxed first, but kicks  
in strict behavior as soon as validators are defined


>       * Strict: any parameter that fails validation or has no validation  
> defined is removed.

correct


> - I was thinking about writing a custom validator. I believe I need  
> to register this at the start of the validation .xml file? I see the  
> ConfigHandler has several of these definitions hard coded, is there  
> an easy way to make some custom validators know by default, so I  
> don't have to redeclare them in every file? Is this something best  
> handled by using a parent .xml file with all custom validators?

you just do <validator class="MyCustomValidator" />, the class has to  
be in autoload.xml though (or autoloadable through an external  
autoloader).

you _can_ pre-define validators for later use, but it's not necessary  
for just using custom validator implementations.

Hope that helps,

David

_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users

Reply via email to