PEAR QuickForm "Fatal error: Uncaught <table..."

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
ajnabi
Forum Newbie
Posts: 1
Joined: Tue Nov 04, 2008 9:00 am

PEAR QuickForm "Fatal error: Uncaught <table..."

Post by ajnabi »

Installation on Kubuntu 8.04.1

I am using PEAR for the first time. I have installed the QuickForm2 package and I am getting the following error from a small hello world program:

Code: Select all

 
Fatal error: Uncaught <table border="1" cellspacing="0"> <tr><td colspan="3" bgcolor="#ff9999"> <b>HTML_QuickForm2_InvalidArgumentException</b>: Element type 'header' is not known in <b>/usr/share/php/HTML/QuickForm2/Container.php</b> on line <b>262</b></td></tr> <tr><td colspan="3" bgcolor="#aaaaaa" align="center"><b>Exception trace</b></td></tr> <tr><td align="center" bgcolor="#cccccc" width="20"><b>#</b></td><td align="center" bgcolor="#cccccc"><b>Function</b></td><td align="center" bgcolor="#cccccc"><b>Location</b></td></tr> <tr><td align="center">0</td><td>HTML_QuickForm2_Factory::createElement('header', null, 'Please enter you&hellip;', Array)</td><td>/usr/share/php/HTML/QuickForm2/Container.php:262</td></tr> <tr><td align="center">1</td><td>HTML_QuickForm2_Container->addElement('header', null, 'Please enter you&hellip;')</td><td>/home/frank/dev/www/exp/pearlearn.php:6</td></tr> <tr><td align="center">2</td><td>{main}</td><td>&nbsp;</td></tr> </table> thrown in /usr/share/php/HTML/QuickForm2/Factory.php on line 235
 
Line 235 of /usr/share/php/HTML/QuickForm2/Factory.php is the throw line of this function:

Code: Select all

 
public static function createElement($type, $name = null, $attributes = null,
                                         array $data = array())
    {
        $type = strtolower($type);
        if (!isset(self::$elementTypes[$type])) {
235-->      throw new HTML_QuickForm2_InvalidArgumentException("Element type '$type' is not known");
        }
        list($className, $includeFile) = self::$elementTypes[$type];
        if (!class_exists($className, false)) {
            self::loadClass($className, $includeFile);
        }
        return new $className($name, $attributes, $data);
    }
 
My code:

Code: Select all

 
<?php
 
    require_once 'HTML/QuickForm2.php';
 
    $form = new HTML_QuickForm2('formHello');
    $form->addElement('header', null, 'Please enter your name');
    $form->addElement('text', 'username', 'Your Name');
    $form->addElement('submit', 'submit', 'Say Hello');
    $form->addRule('username', 'A username is required', 'required');
 
    if ($form->validate())
    {
        $form->freeze();
        echo "Hello " . $form->exportValue('username') . "<hr />";
    }
 
    $form->display();
?>
 
Any insights appreciated.
 
Thanks,
Frank
 
Post Reply