Hey Jason,

that's where I was looking and couldn't find any. Sure, I can write my own validator, I just couldn't believe I was the first one finding the obvious gap in the existing validators.

What I need is a validator that compares one field's value to another. Something along the lines of:

$f = array();
$v = 'password' => array(
        array('SameAsField', 'password2')
      );
$input = new Zend_Filter_Input($f, $v, $_POST);
if ($input->hasInvalid()) {
    echo "Uh-oh, the password fields do not contain the same value!";
}

Now, is the field "password" does not have the same value as the field "password2", then an error message is shown.

Am I the only one finding this useful? If not, how does one go about adding validators? Is a proposal needed or should I just send the code to the package maintainer?

CU
 Markus

Jason Qi schrieb:
Hi Markus,

Do you think the Standard Validation Classes is useful
for you?
http://framework.zend.com/manual/en/zend.validate.set.html

Or you might write Validators yourself to fit your
needs. see here:

http://framework.zend.com/manual/en/zend.validate.writing_validators.html

Regards,

Jason.

--- Markus Wolff <[EMAIL PROTECTED]> wrote:

Hi there,

quite often one has to make a form where a user can
create a user account. It's customary to add two password fields, and add a validation rule so that when the entries in both fields do not match, an error message is presented to the user.

I was searching for such a validation rule for use
with Zend_Filter_Input, but couldn't find any. Am I missing something? Or would you guys do it entirely differently?

CU
  Markus

Reply via email to