-- Marco <[EMAIL PROTECTED]> wrote
(on Friday, 21 March 2008, 08:54 AM +0100):
> I have come across an issue where I need to validate a form field based on the
> value of another form field.
>
> Say for example I have a country list and a field for Vat Number, I need to
> specify the format of the VAT number based on what the user selected in the
> country list.
>
> We are using .ini files to control the form creation and wondered if anyone
> knew if this was possible?
Yes, it is. See this section of the manual:
http://framework.zend.com/manual/en/zend.form.elements.html#zend.form.elements.validators
and look for the note entitled 'Validation Context'.
Basically, you'll create a custom validation class, and have its
isValid() method accept a second argument, $context, which will be the
array of values being validated in the form. Add the prefixPath for that
validator to your config file, and then you'll be able to use it in your
validations.
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/