2009-04-21 4 views
0

를 작동하지 모두 개별적으로 작업하는 날짜 선택 (ZendX_JQuery_Form_Element_DatePicker)젠드 내가 두 장식 을 사용하고 ZendX_JQuery_Form

를 얻으려면 아니지만 동시에

에서 오류 :

Warning: Exception caught by form: Cannot render jQuery form element without at least one decorator implementing the 'ZendX_JQuery_Form_Decorator_UiWidgetElementMarker' interface. Default decorator for this marker interface is the 'ZendX_JQuery_Form_Decorator_UiWidgetElement'. Hint: The ViewHelper decorator does not render jQuery elements correctly. 

내 가져 오기 양식 기능 :

$form = new Form_Job(); 
$form->setDecorators(Decorator::$formDecorators); 
$form->setElementDecorators(Decorator::$elementDecorators); 
$form->getElement('submit')->setDecorators(Decorator::$buttonDecorators); 

양식 클래스 Form_Job() 나는 http://framework.zend.com/manual/en/zend.form.decorators.html

jQuery Decorators: Beware the Marker Interface for UiWidgetElements

By default all the jQuery Form elements use the ZendX_JQuery_Form_Decorator_UiWidgetElement decorator for rendering the jQuery element with its specific view helper. This decorator is inheritly different from the ViewHelper decorator that is used for most of the default form elements in Zend_Form. To ensure that rendering works correctly for jQuery form elements at least one decorator has to implement the ZendX_JQuery_Form_Decorator_UiWidgetElementMarker interface, which the default decorator does. If no marker interface is found an exception is thrown. Use the marker interface if you want to implement your own decorator for the jQuery form element specific rendering.

에서이 도움말을 가지고하지만 난이를 구현하는 코드가 필요

class Form_Job extends ZendX_JQuery_Form { 
    public function init() { 
     $element = new ZendX_JQuery_Form_Element_DatePicker('date_from'); 
     $element->setLabel('Campaign Period From :'); 
     $element->setRequired(true); 
     $element->setAttrib('size', '10'); 
     $element->setJQueryParam('dateFormat', 'yy-mm-dd'); 

     $this->addElement($element); 
    } 
} 

,

답변

1

을 제안 해주십시오 내 대답을 얻었다 : -

내가 사용했습니다

public static $formJQueryElements = array(
     array('UiWidgetElement', array('tag' => '')), // it necessary to include for jquery elements 
     array('Errors'), 
     array('Description', array('tag' => 'span')), 
     array('HtmlTag', array('tag' => 'td')), 
     array('Label', array('tag' => 'td', 'class' =>'element')), 
     array(array('row' => 'HtmlTag'), array('tag' => 'tr')), 
); 
$form->getElement('jq_date')->setDecorators(Decorator::$formJQueryElements); 

jquery 요소의 경우 테이블 형식 정렬에 적합합니다.