HTML_QuickForm Default Renderer...what the...?
| From: | Justin Patrin | Date: | Fri, 11 Feb 2005 18:48:39 +0000 |
| Subject: | HTML_QuickForm Default Renderer...what the...? | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-36151@lists.php.net to get a copy of this message | ||
I just ran into a very strange bug pertaining to HTML_QuickForm's
defaultRenderer method. I'm working on a system which embeds a form
within an element and I lost most of my form (and it gets output very
strangely). I finally tracked this down to the defaultRenderer method.
Since this returns reference to a globally stored renderer and all of
the methods which use this use references, the nested form picks up
the same renderer as the parent form, causing the output to be reset,
ending up with some very strange HTML.
If I change this method to:
function &defaultRenderer()
{
include_once('HTML/QuickForm/Renderer/Default.php');
$renderer =& new HTML_QuickForm_Renderer_Default();
return $renderer;
} // end func defaultRenderer
Everything works as expected.
I can see from the HTML_QuickForm changelogs that this function was
part of the original renderer system that was checked in (rev 1.72 of
QuickForm.php I think) and was never changed since then.
If I specify a renderer in my "sub-form" then everything works as
expected as well.
I propose this function be changed not to use a global so that things
like what I'm trying to do will work. In addition, this will make QF
work the same by default as if you specify your own renderer.
--
Justin Patrin