Forms ZendX_JQuery对话框容器使用

Forms ZendX_JQuery对话框容器使用,forms,zendx,Forms,Zendx,我打算使用ZendX_JQuery dialogContainer view helper来生成一个模式窗口,用户可以输入指定的信息(例如发送消息)。我正试图以这种方式使用dialogContainer视图帮助程序 首先,将ZendX库包括在应用程序库文件夹中 其次,在Bootstrap.php文件的initViewHelper方法中包含以下行 “$view->addHelperPath('ZendX/JQuery/view/Helper/','ZendX\u JQuery\u view\u H

我打算使用ZendX_JQuery dialogContainer view helper来生成一个模式窗口,用户可以输入指定的信息(例如发送消息)。我正试图以这种方式使用dialogContainer视图帮助程序

首先,将ZendX库包括在应用程序库文件夹中

其次,在Bootstrap.php文件的initViewHelper方法中包含以下行

“$view->addHelperPath('ZendX/JQuery/view/Helper/','ZendX\u JQuery\u view\u Helper')

第三,在layout.phtml中添加js的以下条件启用

  "<?php if($this->jQuery()->isEnabled()){
              $this->jQuery()->setLocalPath($this->baseUrl()
              .'/js/jquery/js/jquery-1.4.2.min.js')                   
              ->setUiLocalPath($this->baseUrl()
              .'/js/jquery/js/jquery-ui-1.8.custom.min.js')                   
              ->addStylesheet($this->baseUrl()
              .'/js/jquery/css/ui-lightness/jquery-ui-1.8.custom.css');
              echo $this->jQuery();
        }
   ?>"
“”
第四,创建我的应用程序表单扩展ZendX表单

   "<?php
     class Application_Form_JQueryForm extends ZendX_JQuery_Form
      {
       private $form;

       public function init()
      {
         $this->form =  $this->setAction(Zend_Controller_Front::getInstance()->getBaseUrl() . '/index/index')
                      ->setMethod('post');


    $this->form->setDecorators(array(
        'FormElements',
        'Form',
        array ('DialogContainer', array(
            'id'    => 'tabContainer',
            'style' => 'width: 600px;',
            'title' => 'Send a private message to Kalle',
            'JQueryParams'  => array(
                'tabPosition'   => 'top',                    
            ),
        )),
    ));

   $topic = new Zend_Form_Element_Text('topic');
    $topic->setValue('topic')
          ->setRequired(true)
          ->setValidators(array('validators' => array(
              'validator' => 'StringLength',
              'options' => array(1,15)
          )))
          ->setDecorators(array(
               'ViewHelper',
               'Description',
               'Errors',
               array('HtmlTag', array('tag' => 'dl'))));

    $textarea = new Zend_Form_Element_Textarea('textarea');
    $textarea->setValue('post a comment')
             ->setAttribs(array(
                 'rows' => 4,
                 'cols' => 20
             ))
             ->setRequired(true)
             ->setValidators(array('validators' => array(
              'validator' => 'StringLength',
              'options' => array(1,15)
             )))
             ->setDecorators(array(
               'ViewHelper',
               'Description',
               'Errors',
                 array('HtmlTag', array('tag' => 'dl'))));

    $submit = new Zend_Form_Element_Submit('submit');
    $submit->setLabel('Send your comment')
           ->setDecorators(array(
               'ViewHelper',
               'Description',
               'Errors',
               array('Description', array('escape' => false, 'tag' => 'span')),
               array('HtmlTag', array('tag' => 'dl'))))
            ->setDescription('or <a href="/index/index/send/false">Cancel</a>');


    $this->form->addElements(array($topic, $textarea, $submit));       
}

“答案肯定晚了-但是有很多视图-所以我想我会回答。您要为模式设置的参数应该从JQueryParams数组中设置。因此-例如:

$this->form->setDecorators(array(
   'FormElements',
   'Form',
   array ('DialogContainer', array(
           'id'           => 'tabContainer',
           'style'        => 'width: 600px;',
           'title'        => 'Send a private message to Kalle',
           'JQueryParams' => array(
               'tabPosition' => 'top', 
               'width'       => '600',
               'height'      => '450'
       ),
   )),
));
您可以在jQuery UI站点上找到这些参数选项


jQueryParams
的LK

j
应为小写。