Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7039619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:49:13+00:00 2026-05-28T01:49:13+00:00

I have a simple zend form class Form_Upload extends Zend_Form { private $_networks =

  • 0

I have a simple zend form

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'))
    ));

    }
}

trying to create a table based form. But as soon as I add the element decorators

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

form disappears. My view only has <?php echo $this->form; ?> and if I remove the setElementDecorators, form displays correctly (without table layout of course).

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:49:14+00:00Added an answer on May 28, 2026 at 1:49 am

    My guess is that you don’t show your warnings/exceptions and you’re getting an exception from the Zend_Form_Element_File elements. You set the decorators for all the elements including those file elements. But file elements need the file decorator in order for them to work.

    Set the decorators for the file elements after the setElementDecorators and see how that turns out. Or just leave out the file elements in order to test if that’s what’s causing your problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple content edit form (Zend_Form) that I populate() with an array
I have a simple Zend-based form with reCaptcha element: $form = new Zend_Form(); $form->setName('forgotpassword')
The question is quite simple : I have a controller plugin for Zend Framework.
I have simple form. <form target=_blank action=somescript.php method=Post id=simpleForm> <input type=hidden name=url value=http://...> <input
I have weird problem with zend framework basics. I have simple action in IndexController:
On my bootstrap I don't have a class, it's a simple php file: I
I'm recently have learned to use Zend Framework. I did a simple CRUD application.
I am new to zend framework. I have used zend form and decorators to
i am using zend form and i have a condition such that: when i
I use PHP, MySQL and Zend Framework. I have some simple tables with simple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.