Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery ui Zend decorators:如何在表单上使用jquery ui类?_Jquery Ui_Zend Framework_Zend Form_Zendx - Fatal编程技术网

Jquery ui Zend decorators:如何在表单上使用jquery ui类?

Jquery ui Zend decorators:如何在表单上使用jquery ui类?,jquery-ui,zend-framework,zend-form,zendx,Jquery Ui,Zend Framework,Zend Form,Zendx,我使用jquery在Zend框架中创建了一个表单: class Contact_Form_Contact extends ZendX_JQuery_Form { public function init() { /* Form Elements & Other Definitions Here ... */ //create new element $name = $this->createElement('text',

我使用jquery在Zend框架中创建了一个表单:

    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状态错误my clean


Arman。

认真阅读Zend的博客后,我发现使用decorator很容易做到这一点:

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

您可以这样设置装饰器选项,而不是覆盖装饰器:

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

这个解决方案也很有用。