Migration to version 3.2

Migration to version 3.2 – API changes to observe

Why these changes?

HTML_QuickForm has improved a lot since version 2.x. With the addition of a new renderer layer, a lot of methods that were located in the main QuickForm class were actually duplicates of methods in the renderers. Those methods were kept to give user time to adjust their code. With release 3.2 they will be removed, making QuickForm class much lighter and consistent.

At the same time, file upload validation was moved to the file element as this is a more appropriate place.

Removed methods

  • QuickForm related

    • HTML_QuickForm::getAttributesString()
    • HTML_QuickForm::addElementGroup()
    • HTML_QuickForm::addHeader()
    • HTML_QuickForm::addData()
  • Renderer related

    • HTML_QuickForm::setElementTemplate()
    • HTML_QuickForm::setHeaderTemplate()
    • HTML_QuickForm::setFormTemplate()
    • HTML_QuickForm::setRequiredNoteTemplate()
    • HTML_QuickForm::clearAllTemplates()
    • HTML_QuickForm_group::setElementTemplate()
    • HTML_QuickForm_group::setGroupTemplate()
  • File upload related

    • HTML_QuickForm::isUploadedFile()
    • HTML_QuickForm::getUploadedFile()
    • HTML_QuickForm::moveUploadedFile()

How to adjust your code

QuickForm related



will return the same value by using HTML_Common::getAttributes() method.


Arguments order was changed to conform to the way elements are usually added to QuickForm by addElement(). Use HTML_QuickForm::addGroup() instead and swap the element label with the element name.


A header is now considered like any other element. There is a new HTML_QuickForm_header element that extends HTML_QuickForm_static. Just use


This will also allow you to customize the header rendering based on its name.


If you absolutely need this feature, use


or consider using some template-based renderer.

Renderer related

Those methods are now handled by the renderers. How to use these methods depends on your choice of renderer. With QuickForm default renderer, you can use these methods like that:

=& new HTML_QuickForm('myform');

$renderer =& $form->defaultRenderer();
$renderer->setHeaderTemplate('<tr><td colspan="2"><b>{header}</b></td></tr>');
$renderer->setGroupElementTemplate('<td>{element}<br /><!-- BEGIN required -->*<!-- END required -->{label}</td>');

defaultRenderer()will return a reference to QuickForm integrated renderer. You can of course use any other renderer available in QuickForm such as Sigma, ITX, Smarty, Flexy and so on. Have a look at their documentation to see which methods are available for them.

File upload related

File-related methods and rules have been moved to the file element HTML_QuickForm_file because it makes more sense this way and you don't have to include upload-related code if you are not using uploads. You have access to these methods like that:

= new HTML_QuickForm('myform');
$file =& $form->addElement('file''myfile''Your file:');
$form->addRule('myfile''Cannot exceed 1776 bytes''maxfilesize'1776);
if (
$file->isUploadedFile()) {

or like that:

=& $form->getElement('myfile');
if (
$file->isUploadedFile()) {
$fileInfo $file->getValue();
What elements can be added to QuickForm (Previous) An overview about subpackages and packages that use QuickForm (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.