#1290: Validated Arguments are discarded in case a validator wrapped by an
AgaviOroperatorValidator fails on them
-----------------------------------------+----------------------------------
 Reporter:  sven.kretschm...@…           |       Owner:  dominik
     Type:  defect                       |      Status:  new    
 Priority:  normal                       |   Milestone:  1.0.4  
Component:  validation                   |     Version:  1.0.3  
 Severity:  normal                       |    Keywords:         
Has_patch:  0                            |  
-----------------------------------------+----------------------------------
 We have a form including a payment type dropdown. Depending on the
 selected type we want to do more validation using dependencies. The
 dependencies do work well, but we do not get the selected payment type,
 although a validator on that argument succeeded.

 In short, we'd like to validate a value not with an inarray validator, but
 use or'ed equals validators to provide different depencies.

 The validation configuration of the or- validation:

 {{{
 #!xml
 <validator class="or">
   <validators>
     <validator class="equals" provides="payment_bank">
       <arguments>
         <argument>payment_type</argument>
       </arguments>
       <ae:parameters>
         <ae:parameter name="value">bank</ae:parameter>
         <ae:parameter name="severity">silent</ae:parameter>
       </ae:parameters>
     </validator>
     <validator class="equals" provides="payment_cc">
       <arguments>
         <argument>payment_type</argument>
       </arguments>
       <ae:parameters>
         <ae:parameter name="value">cc</ae:parameter>
         <ae:parameter name="severity">silent</ae:parameter>
       </ae:parameters>
     </validator>
   </validators>
   <ae:parameters>
     <ae:parameter name="skip_errors">true</ae:parameter>
   </ae:parameters>
   <errors>
     <error>No valid payment type selected.</error>
   </errors>
 </validator>
 }}}

 Even adding an additional validator for the argument does not help:

 {{{
 #!xml
 <validator class="inarray">
   <arguments>
     <argument>payment_type</argument>
   </arguments>
   <ae:parameters>
     <ae:parameter name="values">bank,cc</ae:parameter>
   </ae:parameters>
   <errors>
     <error>No valid payment type selected.</error>
   </errors>
 </validator>

 <validator class="or">
   <!-- see above -->
 </validator>
 }}}

 The only help we currently have is wrapping the or validator in a not
 validator with skip_errors set to true and severity set to silent:

 {{{
 #!xml
 <validator class="inarray">
   <!-- see above -->
 </validator>

 <validator class="not">
   <validator class="or">
     <!-- see above -->
   </validator>
   <ae:parameters>
     <ae:parameter name="severity">silent</ae:parameter>
     <ae:parameter name="skip_errors">true</ae:parameter>
   </ae:parameters>
 </validator>
 }}}

 With this setup we receive the payment_type value in the action.

 Greets, Sven

-- 
Ticket URL: <http://trac.agavi.org/ticket/1290>
Agavi <http://www.agavi.org/>
An MVC Framework for PHP5



_______________________________________________
Agavi Tickets Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/tickets

Reply via email to