如何在 Jquery Element 中使用部分装饰器
我将此代码用于表单元素:
$title = new Zend_Form_Element_Text('title');
$title->setRequired(true)
->setAttrib('class', 'inputbox')
->setLabel('Title');
$title->viewScript = 'RegElement.phtml';
$title->setDecorators(
array(
array('ViewScript', array('class' => 'RegElement'))
)
);
但是当我使用 Jquery Element 时,我不知道如何实现它:
$datePicker = new ZendX_JQuery_Form_Element_DatePicker(
"datePicker1", array("label" => "Date:")
);
$datePicker->viewScript = 'RegElement.phtml';
$datePicker->setDecorators(
array(
array('ViewScript', array('class' => 'RegElement'))
)
);
//views/scripts/RegElement.phtml
<li class="row <?php echo $this->class ?>">
<div class="cont-error">
<?php echo $this->formErrors($this->element->getMessages()); ?>
</div>
<div class="rowfields">
<?php echo $this->formLabel($this->element->getName(),
$this->element->getLabel()) ?>
<?php
echo $this->{$this->element->helper}(
$this->element->getName(),
$this->element->getValue(),
$this->element->getAttribs()
)
?>
</div>
<div class="hint"><?php echo $this->element->getDescription() ?></div>
</li>
并显示此错误:
Warning: Exception caught by form: Cannot render jQuery form element without at least one decorator implementing the 'ZendX_JQuery_Form_Decorator_UiWidgetElementMarker' interface.
我需要以相同格式显示 datePicker。但我不知道如何实现这个接口。谢谢你的帮助。