Hi,

no, you can't nest normal validators. There a special boolean validators which 
provide such a functionality 
(http://www.mivesto.de/agavi/agavi-faq.html#validation_1).
In your case you should use the depends/requires mechanism for this (see 
http://www.mivesto.de/agavi/agavi-faq.html#validation_4 for a description).
But beware of the scoping issues (which you can already see a glimpse of the in 
the faq entry), a good reference for the current behaviour and 
it's problems is at http://trac.agavi.org/ticket/1199. in 1.1 this will see 
some changes (also explained in the ticket) to make the behaviour a lot
more sane.
In your case you don't have to use the base at all, since you can just use 
array syntax in the argument itself.

So you could write your example as:

<validator class="string" name="invalid-category-name-empty" required="true" 
provides="category_is_set">
  <argument>data[name]</argument>
  <error>No Category</error>
</validator>
 
 
<validator class="Category_CategoryValidator" name="invalid-category-name" 
depends="category_is_set">
  <argument>data[name]</argument>
   <error>Category already exists</error>
   <ae:parameter name="export">name</ae:parameter>
</validator>

HTH

Dominik



Am 15.08.2013 um 12:44 schrieb "Frenzel, Timo - REGIOCAST" 
<[email protected]>:

> hi,
> Can I nest validators?
> 
> I want that if a default validator was successful, a customer validator is 
> executed.
>  
>  
> First:
>  
> <validator class="string" name="invalid-category-name-empty" required="true">
>                 <arguments base="data">
>                 <argument>name</argument>
>                 </arguments>
>                 <error>No Category</error>
> </validator>
>  
>  
> if this was successful
>  
>  
> <validator class="Category_CategoryValidator" name="invalid-category-name">
>                 <arguments base="data">
>                                <argument>name</argument>
>                 </arguments>
>                 <errors>
>                                 <error>Category already exists</error>
>                 </errors>
>                 <ae:parameters>
>                                <ae:parameter name="export">name</ae:parameter>
>                 </ae:parameters>
> </validator>
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.agavi.org/mailman/listinfo/users


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

Reply via email to