Zend_Form中的ZendX_JQuery元素

时间:2012-09-27 22:40:20

标签: zend-framework zend-form

我有一个扩展Twitter_Form(一个Twitter bootstrap css表单)的表单,后者又扩展了Zend_Form。我想在Zend_Form中添加ZendX_JQuery元素,但由于装饰器我得到错误

错误是

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

表单类是:

class Application_Form_Classes extends Twitter_Form {

   $autocomplete = new ZendX_JQuery_Form_Element_Autocomplete('demo-input-local');
   $autocomplete->setJQueryParam('url','http://.../something.php');

   $this->addElement($autocomplete);


   $this->addElement("submit", "register", array("label" => "Register"));}

1 个答案:

答案 0 :(得分:0)

我将自定义multipleautocomplete viewhelper添加到我的Twitter_Form作为子表单。如果有其他方法可以做,请发一个答案。

class Application_Form_Classes extends Twitter_Form{

   public function init(){

       $jqueryform = new ZendX_JQuery_Form();

       $multiautocomplete = new ZendX_JQuery_Form_Element_Multiautocomplete('demoinputlocal');
       $multiautocomplete->setJQueryParam('url','http://..../something.php');

        $jqueryform->addElement($multiautocomplete);

        $this->addSubForm($jqueryform, "jqueryform");

       $this->addElement("submit", "register", array("label" => "Register"));
       $this->addElement("reset", "reset", array("label" => "Reset"));

    }
}