2011-02-10 11 views
4

表示グループからラベルを削除する方法を理解しようとしていますが、下の マークアップを見ると、IDアドレスラベルと次のddを持つdtがあることがわかります、私はこれらを削除したいが、 フィールドセットを保持したい。Zend Form表示グループデコレータ

表示グループを追加するには、それぞれの要素を追加した後で、この$this->addDisplayGroup(array(...), 'legend' => 'address');を myフォームのinitクラス内に使用しています。私がしたくない要素を削除するために遊ぶことができるいくつかのデコレータがありますか?

<form id="CreateAddress" enctype="application/x-www-form-urlencoded" action="" method="post"> 
    <dl class="zend_form"> 
     <dt id="address-label">&#160;</dt> 
     <dd id="address-element"> 
      <fieldset id="fieldset-address"> 
       <legend>Address</legend> 
       <dl>    
        <dt id="addressLine1-label"> 
         <label for="addressLine1" class="required">Address Line 1</label> 
        </dt> 
        <dd id="addressLine1-element"> 
         <input type="text" name="addressLine1" id="addressLine1" value=""> 
        </dd> 

        ...etc... 

      </fieldset> 
     </dd> 
     ...buttons... 
    </dl> 
</form> 

おかげで、
マーティン

答えて

0

ので、契約は何ですか?

$group = $form->getDisplayGroup ('the name of the group'); 
$group->removeDecorator ('Zend_Form_Decorator_DtDdWrapper'); 
5

removeDecoratorパラメータZend_Form_Decorator_DtDdWrapperので、私が使用動作しませんでした:

$group = $form->getDisplayGroup('the name of the group'); 
$group->removeDecorator('DtDdWrapper'); 
1

を手動で個別に各表示グループからDtDd年代を削除する必要がないように、あなたが使用することができます。

foreach ($this->_displayGroups as $dg){ 
      $dg->removeDecorator('DtDdWrapper'); 
     } 
8

(特定のフォーム用に)定義されたすべてのZendフォーム表示グループに適用する場合は、より慎重な方法があります。

$form->setDisplayGroupDecorators(array(
    'FormElements', 
    'Fieldset', 
)); 

注:これは以前に定義された表示グループのみを変更します。