You need separate validator tags. Some validators can have several arguments, 
but then, these arguments are validated together in a way specific to the 
validator you're using.

Example: AgaviDateTimeValidator can have three arguments for "day", "month" and 
"year" to validate a given date. Only in such a case, by the way, do you need 
to name an argument. In all other cases, <argument> without a "name" attribute 
is enough.
Another example would be AgaviEqualsValidator, where all arguments you define 
are tested to be equal to one another.
Custom validators also use this quite often. Let's say you have an 
ArticleValidator, which can accept two named arguments: "id" and "slug". "slug" 
could even be optional; only if provided, the validator would also make sure 
that the given slug is correct, otherwise it would just validate the article ID 
(and probably then export the article model object it retrieved from a database 
to the request data).

- David


On 17.06.2010, at 18:19, Goessens, Bram wrote:

> Hi,
> 
> I want to validate multiple non-required fields in a form. All arguments
> have the same (=none) parameters and errors so I would like to nest the
> arguments to shorten the code.
> 
> Is it possible to have multiple argument-tags in the arguments-tag or do
> you need a full copy of the validator-tag for each argument?
> 
> 
> this example doesn't work when given 2 argument-tags inside the
> arguments-tag:
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <ae:configurations
>       xmlns="http://agavi.org/agavi/config/parts/validators/1.0";
>       xmlns:ae="http://agavi.org/agavi/config/global/envelope/1.0";
>       parent="%core.config_dir%/validators.xml"
>> 
>       <ae:configuration>
>       <validators method="read">
>                       <validator class="string" required="false"
> severity="silent">
>                               <arguments>
>                                       <argument
> name="val_name">name</argument>
>                                       <argument
> name="val_first_name">first_name</argument>
>                               </arguments>
>                       </validator>    
>               </validators>
>       </ae:configuration>
> </ae:configurations>
> 
> 
> 
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.agavi.org/mailman/listinfo/users
> 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

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

Reply via email to