English 中文(简体)
Zend Frame 灵活格式元素和 jQuery
原标题:Zend Framework flexible Form Elements with jQuery

我对Zend Framewer非常新奇,我开始得到它的主轴, 但我再次遇到一个问题。 我想创建一种格式, 让用户可以上传文件 。

现在的想法是,当用户先用窗体访问页面时,他/她将只看到一个有 wich 的窗体元素上传文件,然后在按钮下上传一个文件,再添加一个文件,从而在窗体上添加一个额外元素。

我一直在四处看看,有人建议我尝试使用JQuery, 此时此刻,也许应该提及我从未使用过JQuery, 更不用说与Zend框架相结合了。

我将ZendX 库添加到同一文件夹中, 我也有 ZendX 文件夹, 像这样

/Zend Framework
 /library
  /Zend
  /ZendX

I of course have the library folder included in my include_path variable in the php.ini . According to what i can make of the Zend Refference guide i need to add the following to my Bootstrap.

public function _initJQuery() {
    $view = new Zend_View();
    $view->addHelperPath("ZendX/JQuery/View/Helper", "ZendX_JQuery_View_Helper");
    $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
    $viewRenderer->setView($view);
    Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
}

完成后,我在内容模块中构建了以下 Jquery 格式。

<?php
class Content_Form_JQueryForm extends ZendX_JQuery_Form
{
    public function init()
    {
        $this->setMethod( post );
        $this->setName( frm );
        $this->setAction( content/index/add );

        $date1 = new ZendX_JQuery_Form_Element_DatePicker(
                 date1 ,
                array( label  =>  Date: )
             );

        $this->addElement($date1);

        $elem = new ZendX_JQuery_Form_Element_Spinner(
                "spinner1", 
                array( label  =>  Spinner: )
        );

        $elem->setJQueryParams(array( min  => 0,  max  => 1000,  start  => 100));
        $this->addElement($elem);
    }
}

然后在控制器中我简单地创建窗体并将其指定为视图

public function indexAction() {
    $form = new Content_Form_JQueryForm();
        $this->view->form = $form;
}

当然,在适当的观点中,我赞同表的形式

<?php echo $this->form; ?>

当我运行程序时,我收到以下错误信息

致命错误: C:wampwwwend Project applicationmodulescontent controllersCategory Contractor.php 在 C:wampwwwend Project applicationmoules controllers Category Contractors.php 中找不到分类内容 _Form_JQueryForm 。

我对我做的错事一无所知 如果有谁能帮助我 我会感激不尽

最佳回答

最后,我对这个教程,http://www.jeremykenddall.net/2009/01/19/ indival-adding-elements-to-zend-form/ 感到困惑。

它帮助人们了解了Zend的形式是如何运作的。

问题回答

暂无回答




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签