Re: HTML_QuickForm_Element accessing the HTML_QuickForm form name

From: Date: Wed, 23 Feb 2005 17:26:37 +0000
Subject: Re: HTML_QuickForm_Element accessing the HTML_QuickForm form name
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-17648@lists.php.net to get a copy of this message
I can't see how it's possible for an HTML_QuickForm_Element class to access the name of the form which it belongs to. Try overriding the onQuickFormEvent() method in your QuickForm inherited class. The parameter you're probably interested in is $caller.
function onQuickFormEvent($event, $arg, &$caller) { var_dump($caller); return parent::onQuickFormEvent($event, $arg, $caller); } That's the only place I could figure out where to access the name of the form that the QuickForm element was a member of. In the end though, I realized that the javascript code I added for use in the QuickForm didn't actually need to know the name of the form. I found that removing my own onQuickFormEvent() method and relying on javascript to figure out what form to deal with was a much better solution. The (unfinished) source code at http://jalessio.com/pear/ might give you some ideas on how to make that happen. - Jamie
I've put some javascript into a form element which relies on the formanme being known by some other included javascript, so the HTML_QuickForm_Element::toHtml() mehtod calls some javascript to set some variables. Anyway, all that is pretty irrelivent ;) does anyone know if there is a way for a HTML_QuickForm_Element to know the name of the form? I would have thoguht that each element would comtain a pointer to the form, but it doesnt' appear to. Any thoughts? Kind Regards,


« previous php.pear.general (#17648) next »