2010-01-27 11 views
0

데코레이터를 사용하여 Zend_Form이 출력하는 HTML을 변경하려고합니다. 이미 아래 섹션을 깼다Zend_Form의 HTML 출력 변경

<form> 
    <fieldset> 
    <legend>Your Details</legend> 
    <dl> 
    <dt>label etc</dt> 
    <dd>input etc</dd> 
    <dt>label etc</dt> 
    <dd>input etc</dd> 
    </dl> 
    </fieldset> 
    <fieldset> 
    <legend>Address Details</legend> 
    <dl> 
    <dt>label etc</dt> 
    <dd>input etc</dd> 
    <dt>label etc</dt> 
    <dd>input etc</dd> 
    ... etc ... 
    </dl> 
    </fieldset> 
</form> 

내가 표시 그룹, 예를 사용하여 특정 필드 셋 내에서 원하는 :

나는 출력 된 HTML은 다음과 같이 할

$this->addDisplayGroup(array('name','email','telephone'),'yourdetails'); 
$yourdetails= $this->getDisplayGroup('personal'); 
$yourdetails->setDecorators(array(
      'FormElements', 
      'Fieldset' 
)); 

이 나에게 FIELDSET 내에서 앉아 각 섹션을 제공하지만, 각 양식 요소는 이제 내가 무엇을하는 포장 DL을 부족 :

<form> 
    <fieldset> 
    <dt>label etc</dt> 
    <dd>input etc</dd> 
    <dt>label etc</dt> 
    <dd>input etc</dd> 
    </fieldset> 
    ... etc 
</form> 

답변

2

이 시도 :

$yourdetails->setDecorators(array(
      'FormElements', 
      array('HtmlTag', array('tag' => 'dl')), 
      'Fieldset' 
)); 

을 그 해야합니다 :

  1. 요소를 반복합니다. 의
  2. 이, 실행 실제로 <dl>
+0

주위에 <fieldset> 추가 요소의 그룹 주위에 <dl> 추가! 고마워요 :) – robjmills