0
我已经为客户端注册做了一个表单,但是我无法使这个验证器工作。简单的验证器不想工作
//POST-VALIDATORS
$this->validatorSchema->setPostValidator(
new sfValidatorSchemaCompare(
'email', sfValidatorSchemaCompare::EQUAL, 'reemail',
array(),
array('invalid' => "Les adresses mails sont différentes !")
));
$this->validatorSchema->setPostValidator(
new sfValidatorSchemaCompare(
'password', sfValidatorSchemaCompare::EQUAL, 'repassword',
array(),
array('invalid' => "Les mots de passe sont différents !")
));
$this->validatorSchema->setPostValidator(new sfValidatorCallback(
array('callback' => array($this,'checkEmailAvailability'))
));
奇怪的是:只有使用我的custum函数sfValidatorCallback工作。当我用两个不同的值提交表单时,例如在密码和重新输入密码字段时,表单被正确提交并且没有错误发生。
有人知道了吗?
在此先感谢您的帮助。
噢好吧,那很奇怪!所以我想我可以这样做: – h1ghfive 2012-01-12 16:35:32
$ this-> validatorSchema-> setPostValidator(new sfValidatorAnd(array( new sfValidatorSchemaCompare( – h1ghfive 2012-01-12 16:35:49
POsting code sucks in comment。无论如何非常感谢您的解释:) – h1ghfive 2012-01-12 16:36:28