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 6635805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:06:10+00:00 2026-05-25T23:06:10+00:00

I have the problem, that the following Zend Form throws an error. The problem

  • 0

I have the problem, that the following Zend Form throws an error.
The problem is the “file”-element and using setElementDecorators.

    class Products_AddForm extends Zend_Form
{
    function init() {

       // other form elements...

       $uploadElement = new Zend_Form_Element_File('Excel');
       $uploadElement->setLabel('Excel');
       $this->addElement($uploadElement);

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



    }
}

This throws an error.

(Warning: Exception caught by form: No file decorator found... unable to render file element Stack Trace: #0 ) 

Adding $uploadElement->addDecorator('File'); at the end after the SetElementDecorators will work, but this will give me the file element twice!

Can anybody help, please?

TIA
Matt

  • 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-25T23:06:11+00:00Added an answer on May 25, 2026 at 11:06 pm

    The File element requires it’s own decorator – Zend_Form_Decorator_File.

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

    [edit]

    Have just noticed that you are also using other form elements.

    After your original code, add:

    $this->getElement('Excel')->setDecorators(
        array(
            'File',
            'Errors',
            array(array('data' => 'HtmlTag'), array('tag' => 'td')),
            array('Label', array('tag' => 'th')),
            array(array('row' => 'HtmlTag'), array('tag' => 'tr'))
        )
    );
    

    That way, ViewHelper is added to all other elements, and for your File element File is used instead.

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

Sidebar

Related Questions

Today I ran into the following problem with NUnit. I have a class, that
Hi I have problem in code that the following code retuning the error that
I have the following problem that the standard library doesn't solve well, and I'm
I have the following problem that other people must have encountered. I am working
I have the following query of linq to entities. The problem is that it
I have the following problem with Tikz/Latex: I have some nodes that contain text.
I'm using Zend Framework 1.8. I have a problem with headMeta() duplicating my meta
I have a problem that I'm working in nHibernate project that have the following
I have a problem.... I made a java program that does the following: BufferedReader
I have following problem that in a transformation (which is completely done in memory)

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.