English 中文(简体)
Zend Form 得分
原标题:Zend Form won t render

我的表格简明扼要。

class Form_Upload extends Zend_Form
{
    private $_networks = array();
    private $_reportYear;
    public function __construct($options)
    {
        if (array_key_exists( networks , $options)) {
            $this->_networks = $options[ networks ];
            unset($options[ networks ]);
        }
        if (array_key_exists( reportYear , $options)) {
            $this->_reportYear = $options[ reportYear ];
            unset($options[ reportYear ]);
        }
        parent::__construct($options);
    }
    public function init()
    {
        $this->setMethod(Zend_Form::METHOD_POST);
        $this->setAttrib( enctype ,  multipart/form-data );

        $this->setDecorators(array(
             FormElements ,
            array( HtmlTag , array( tag  =>  table )),
             Form 
        ));

        // Report year
        $reportYear = new Zend_Form_Element_Hidden( ReportYear );
        $reportYear->setValue($this->_reportYear);
        $this->addElement($reportYear);

        // Station File
        $stationFile = new Zend_Form_Element_File( StationFile );
        $stationFile->setLabel( Station File )
            ->setMaxFileSize(102400)
            ->addValidator( Extension , false,  csv )
            ->setValueDisabled(true);
        $this->addElement($stationFile);

        $stationFileNetwork = new Zend_Form_Element_Select( StationFileNetwork );
        $stationFileNetwork->setLabel( Network )
                           ->addMultiOptions($this->_networks);
        $this->addElement($stationFileNetwork);

        $stationFileComment = new Zend_Form_Element_Textarea( StationFileComment );
        $stationFileComment->setLabel( Comments )
                           ->setAttrib( cols , 30)
                           ->setAttrib( rows , 5);
        $this->addElement($stationFileComment);

        // Configuration File
        $configurationFile = new Zend_Form_Element_File( ConfigurationFile );
        $configurationFile->setLabel( Configuration File )
            ->setMaxFileSize(102400)
            ->addValidator( Extension , false,  csv )
            ->setValueDisabled(true);
        $this->addElement($configurationFile);

        $configurationFileNetwork = new Zend_Form_Element_Select( ConfigurationFileNetwork );
        $configurationFileNetwork->setLabel( Network )
            ->addMultiOptions($this->_networks);
        $this->addElement($configurationFileNetwork);

        $configurationFileComment = new Zend_Form_Element_Textarea( ConfigurationFileComment );
        $configurationFileComment->setLabel( Comments )
            ->setAttrib( cols , 30)
            ->setAttrib( rows , 5);
        $this->addElement($configurationFileComment);

        // Measurement File
        $measurementFile = new Zend_Form_Element_File( MeasurementFile );
        $measurementFile->setLabel( Measurement File )
            ->setMaxFileSize(102400)
            ->addValidator( Extension , false,  csv )
            ->setValueDisabled(true);
        $this->addElement($measurementFile);

        $measurementFileNetwork = new Zend_Form_Element_Select( MeasurementFileNetwork );
        $measurementFileNetwork->setLabel( Network )
            ->addMultiOptions($this->_networks);
        $this->addElement($measurementFileNetwork);

        $measurementFileComment = new Zend_Form_Element_Textarea( MeasurementFileComment );
        $measurementFileComment->setLabel( Comments )
            ->setAttrib( cols , 30)
            ->setAttrib( rows , 5);
        $this->addElement($measurementFileComment);

        // Submit
        $submit = new Zend_Form_Element_Submit( Upload );
        $submit->setLabel( Upload );
        $this->addElement($submit);

    $this->setElementDecorators(array(
         ViewHelper ,
         Errors ,
        array(array( data  =>  HtmlTag ), array( tag  =>  td )),
        array( Label , array( tag  =>  td )),
        array(array( row  =>  HtmlTag ), array( tag  =>  tr ))
    ));

    }
}

试图建立一个表格。 但是,一旦我增加内容,就立即予以纠正。

$this->setElementDecorators(array(
     ViewHelper ,
     Errors ,
    array(array( data  =>  HtmlTag ), array( tag  =>  td )),
    array( Label , array( tag  =>  td )),
    array(array( row  =>  HtmlTag ), array( tag  =>  tr ))
));

形式消失。 我的看法只有<条码>和>; 而如果我删除了设置的报告员,则正确显示(当然没有表格)。

And I followed this Tutorial - Table layout with Zend Framework form decorators

最佳回答

我的猜测是,你没有显示你的警告/例外,你从<条码>中再次获得例外。 Zend_Form_Element_Files。 您为包括这些档案内容在内的所有内容设置了指导员。 但是,档案材料需要文件校正才能工作。

在<条码>后为文件内容设置了校正员,并由此可见。 或者只是排除档案内容,以便检验这是否造成你的问题。

问题回答

暂无回答




相关问题
Zend 邮件问题,涉及外国char子+ com子

泽斯德邮局在名称被定为具有外国性质(如“保”)和 com(”)的物品时,就放弃了一种例外(因为邮局(邮局)退回假)。 重新提出以下守则。

PHP Framework: Ebay Like Site

I am going to be builiding a site like ebay - with all the features of ebay. Please note my payment method is limited to paypal. What would be the best PHP framework to use to build this quickly, ...

Link to a specific step in onepage checkout

Is it possible to redirect the browser to nth step in the onepage checkout? If so, how would one go about doing it? I m working on a payment module and have a sort of "cancel" action that i would ...

Tagging with Zend Framework

I m trying to create the same solutions as below, but using a simple MySQL query (instead of the static version used below where the words/tags are implemented in the code). The name of the MySQL ...

dynamicaly adding textboxes to zend_form

I hope that this is a quick question to answer. I am developing a form using Zend_Form, I have a number of Zend_Dojo_Form_Element_Textboxs to add to this form dynamically. These are added from rows ...

热门标签