2013-03-24 4 views
0

* 나는 영어가 능숙하지 않다. 이제 코드를 게시 할 것입니다. *젠드 폼 데코레이터 문제

양식 코드 :

protected $elementDecorators = array('ViewHelper','Errors','Description','Label', 
      array('HtmlTag',array('tag' => 'div','class' => '_wrapperElement')   
      )); 

    public function init(){ 
     $this->addElement('text','mytext',array(
     'class' => '_inputText', 
     'label' => 'Mytext', 
     'required' => true, 
     'decorators' => $this->elementDecorators 
     )); 

     $this->setDecorators(array('FormElements',array('HtmlTag',array('tag' => 'div','class' => '_formWrapper')),'Form')); 

    } 

출력 :

<form method="post" action="" enctype="application/x-www-form-urlencoded"> 
    <div class="_formWrapper"> 
     <div class="_wrapperElement"> 
      <div class="_wrapperLabel"> 
       <label class="required" for="mytext">Mytext</label> 
      </div> 
      <div class="_wrapperInput"> 
       <input type="text" class="_inputText" value="" id="mytext" name="mytext">  
      </div> 
     </div> 
    </div> 
</form> 

것을 어떻게 할 수 :

<form method="post" action="" enctype="application/x-www-form-urlencoded"> 
    <div class="_formWrapper"> 
     <div class="_wrapperElement"> 
      <label class="required" for="mytext">Mytext</label> 
      <input type="text" class="_inputText" value="" id="mytext" name="mytext">  
     </div> 
    </div> 
</form> 

지금 내가 이런 DIV 랩 라벨 및 입력 요소를 원하는 ?

여러 번 시도했지만 할 수 없습니다.

감사합니다.

답변

0

데코레이터를 ViewScript에 렌더링하는 솔루션을 찾았습니다.

1
protected $elementDecorators = array('ViewHelper','Errors','Description', array('Label', array('tag' => 'div', 'class' => '_wrapperLabel') 
     ), 
      array('HtmlTag',array('tag' => 'div','class' => '_wrapperInput')   
      ));