PEAR QuickForm "Fatal error: Uncaught <table..."
Posted: Tue Nov 04, 2008 9:49 am
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:
Line 235 of /usr/share/php/HTML/QuickForm2/Factory.php is the throw line of this function:
My code:
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…', 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…')</td><td>/home/frank/dev/www/exp/pearlearn.php:6</td></tr> <tr><td align="center">2</td><td>{main}</td><td> </td></tr> </table> thrown in /usr/share/php/HTML/QuickForm2/Factory.php on line 235
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);
}
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