Pb in Use QuickForm and HTML_page with a renderer
| From: | Jean-Charles Gibier | Date: | Thu, 19 Feb 2004 20:55:15 +0000 |
| Subject: | Pb in Use QuickForm and HTML_page with a renderer | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-10799@lists.php.net to get a copy of this message | ||
Hello,
I have a little pb with the simultaneous use of packages QF and HTML (both
in version 1.1) when I use my own renderer.
My problem is, if I have :
--------------8< --------------
$page = new HTML_Page(... ));
if (!empty($this->headerBuffer)) {
$page->addBodyContent( " nananinnanana ...");
}
...
$form = new HTML_QuickForm('SONDAGE', 'post');
$renderer =& new Phpaie_Renderer_Default ();
$form->accept ($renderer);
$form->validate();
$page->addBodyContent($form->tohtml());
...
--------------8< --------------
-> The renderer stays as the default one, and i can't realize my features.
And if I have the following :
--------------8< --------------
$page = new HTML_Page(... ));
if (!empty($this->headerBuffer)) {
$page->addBodyContent( " nananinnanana ...");
}
$form = new HTML_QuickForm('SONDAGE', 'post');
$renderer =& new Phpaie_Renderer_Default ();
$form->accept ($renderer);
$form->validate();
$page->addBodyContent($renderer->tohtml());
// consider $renderer->tohtml() instead of $form->tohtml()
--------------8< --------------
I've got my good renderer feature, when it is validated but the error
messages does'nt display.
I have found a solution but thats seems quite dirty to me (because I dislike
use globals) :
--------------8< --------------
$GLOBALS['_HTML_QuickForm_default_renderer'] = $renderer =& new
Phpaie_Renderer_Default ();
--------------8< --------------
But there is certainly another solution, or maybe this pb is fixed in the
lastest version ?
Thx
JCG
$GLOBALS['_HTML_QuickForm_default_renderer'] =