Hi, I'm a bit tipsy right now. Just correct me in case I suggest a
wrong advice. =)

$max = $this->getData($this->getParameter('max'));
$min = $this->getData($this->getParameter('min'));

In your XML file, do:

                <validator class="PriceRangeCustomValidator">
                                <argument>pmax</argument>
                                <argument>pmin</argument>
                                <ae:parameter name="max">pmax</ae:parameter>
                                <ae:parameter name="min">pmin</ae:parameter>
                </validator>

Regards,

[ simon.cpu ]

On Mon, Jul 6, 2009 at 8:39 PM, <[email protected]> wrote:
> Hi
>
> I have the following custom validator:
>
> <?php
> class PriceRangeCustomValidator extends AgaviValidator {
>
>  protected function validate()
>  {
>    $max = $this->getData('VehicleSalePriceMax');
>    $min = $this->getData('VehicleSalePriceMin');
>    if ($min > $max)
>    {
>        $this->throwError('max_min_mismatch');
>        return false;
>    }
>    return true;
>  }
>
> }
> ?>
>
> I'd like to reuse this in another form, where the two inputs are named
> pmin and pmax. Is there a way for me to do this - maybe by editing the
> above code to use generic input arguments instead of named form
> inputs?
>
> Thanks
>
> Vikram
>
> _______________________________________________
> 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