1

我已经将一个长的一页表单分成了多个子表单,预计它将在项目生命周期的后期被拆分为一个多页表单。我在下面的 Identical 验证器中遇到了令牌 var 的问题。

从 Application_Form 对象:

$authorizedIndividual = new Zend_Form_SubForm();
// .. authorizedName text element setup here

$termsAgree = new Zend_Form_SubForm();

// Add termsAgree
$termsAgree->addElement('text', 'termsAgree', array(
    'label'         => 'By typing your name in the preceding field, you, as the authorized individual agree to etc. etc. etc.',
    'class'         => 'termsAgree',
    'required'      => true,
    'filters'       => array('StringTrim'),
    'validators'    => array(
        array('validator' => 'Identical', true, $authorizedIndividual->authorizedName )
    )
));
4

1 回答 1

0

据我所知,Zend_Validate_Identical仅适用于字符串标记。通过此令牌从上下文(isValid 数据)中检索该值。

解决问题的最简单方法是在 isValid 方法中定义标记并改用该authorizedName值。

于 2012-01-06T20:19:59.623 回答