我正在尝试使用ZendX_JQuery dialogContainer视图帮助器,以便生成一个模式窗口,用户可以输入指定的信息(例如发送消息)。我正在尝试以这种方式使用dialogContainer视图帮助器。
首先,将ZendX库包含在applications库文件夹中。
其次,在Bootstrap.php文件中的initViewHelper方法中包含以下行
"$view->addHelperPath('ZendX/JQuery/View/Helper/','ZendX_JQuery_View_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_JQuery_Form的Application_Form_JQueryForm
"<?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));
}}“此窗体随后在控制器操作方法中实例化,并在视图中调用。
因此,对于我的问题,无论我尝试什么,例如,为了设置dialogContainer的宽度或任何其他参数(颜色、css、高度等等),这是在表单的JQueryForm表单的setDecorator部分中,当在视图中调用时,我似乎不能在结果模式中获得任何更改,任何正确方向的帮助都将不胜感激
提前谢谢你,卡尔约翰逊
发布于 2011-04-22 02:41:41
答案肯定是迟到了--但有很多观点--所以我想我会回答的。您想要为模式设置的参数应该从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站点上找到这些参数选项。
LK
https://stackoverflow.com/questions/3012897
复制相似问题