Re: HTML_QuickForm_Element accessing the HTML_QuickForm form name

From: Date: Wed, 23 Feb 2005 17:10:54 +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-17651@lists.php.net to get a copy of this message
On Wed, 23 Feb 2005 15:59:10 +0000, Ian P. Christian <pookey@pookey.co.uk> wrote: > 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. > > 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? > The only way I know if to get access to the form object is through onQuickFormEvent. class HTML_QuickForm_myEl extends HTML_QuickForm_element { //other stuff var $_formName; function onQuickFormEvent($event, $arg, &$caller) { switch ($event) { case 'createElement': $this->_formName = $caller->getAttribute($name); return true; default: return parent::onQuickFormEvent($event, $arg, $caller); } } } -- Justin Patrin

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