2011-08-04 3 views
2

은 내가 젠드 프레임 워크를 사용 JQuery와의 양식을 작성 : 젠드 데코레이터 : 내 양식에 jquery-ui 클래스를 사용하려면 어떻게해야합니까?

class Contact_Form_Contact extends ZendX_JQuery_Form { 

    public function init() { 
     /* Form Elements & Other Definitions Here ... */ 
     //create new element 
     $name = $this->createElement('text', 'name'); 
     //element options 
     $name->setLabel("Enter your name:"); 
     $name->setRequired(TRUE); 
     $name->setAttrib('size', 40); 
     //add element to the form 

     $this->addElement($name); 
     ..... 

요청이 setRequired 클래스 = 오류를 가능하게 실패 할 경우

,

방법을 재정의을 "ui-state-error my-clean"?

아르먼.

답변

3

대신 장식을 덮어 쓰는, 당신이 장식 옵션을 설정할 수 있습니다 그 방법 :

$element->getDecorator('Errors')->setOption('class', 'ui-state-error my-clean') 
+0

좋은이 솔루션은 또한 유용합니다. – Arman

2

심각하게 젠드의 블로그를 읽고 나면 나는 그것을 할 매우 쉽다는 것을 발견 장식과 :

$this->setElementDecorators(array(
     'ViewHelper', 
     'Label', 
     array('Errors', array('class'=>'ui-state-error')) 
    )); 
관련 문제