2011-12-12 7 views
1

저는 긴 하나의 페이지 폼을 프로젝트 라이프 사이클의 나중에 다중 페이지 폼으로 분할 될 것으로 예상하여 하위 폼으로 분리했습니다. 아래의 동일한 유효성 검사기에서 토큰 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) 
    ) 
)); 

답변

0

지금까지 내가 아는 한, Zend_Validate_Identical은 문자열 토큰와 함께 작동합니다. 값은이 토큰을 통해 컨텍스트 (isValid 데이터)에서 검색됩니다.

문제의 가장 쉬운 해결책은 isValid 메서드 내에서 토큰을 정의하고 authorizedName 값을 대신 사용하는 것입니다.