RE: [PEAR] Quickform set element focus

From: Date: Fri, 03 Oct 2003 16:03:23 +0000
Subject: RE: [PEAR] Quickform set element focus
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-8267@lists.php.net to get a copy of this message
Hi all, > -----Original Message----- > From: Mike Carter [mailto:mikeatwork@ukonline.co.uk] > > Is it possible to set the initial focus of an element in a > quickform? The setting should produce some code along the lines of: > > <script type="text/javascript" language="JavaScript"><!-- > document.form.element.focus(); > //--></script> > > Is it done or possible to implement in the next release? I was thinking again how to go about implementing this in a re-usable manner. Has nobody here got any ideas? How do I add-on javascript code which will appear in the renderer array when I've called $renderer->toArray() How can I obtain the name of an element that is within a group, along with the name of the form the group belongs to? I'm not sure if its cleanly possible without deep routed hacking of HTML_QuickForm? I'd imagine some method like setElementFocus() which lives in the HTML_QuickForm class, but what would be passed to it? The unique element name (and the group its in?). I found that just using document.form[0].element[0].focus(); can fail, I can't remember the exact reason off the top of my head. Upon calling the renderer it would then pick up on the focus request and add in the javascript (above) to be output in the final HTML template. Have I missed anything? Regards, Mike. ________________________________________________________________________ This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security service working around the clock, around the globe, visit http://www.messagelabs.com ________________________________________________________________________

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