Re: Subclassing a QuickForm element
| From: | Ken Restivo | Date: | Sat, 19 Feb 2005 09:43:00 +0000 |
| Subject: | Re: Subclassing a QuickForm element | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-17579@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Fri, Feb 18, 2005 at 09:10:16AM -0800, Justin Patrin wrote:
> On Thu, 17 Feb 2005 21:37:43 -0800, Ken Restivo <ken@restivo.org> wrote:
> > I need to create a subclass of a standard QF text input element that includes a link wiht
> > an onClick which calls some JS to populate the associated element's value with some custom
> > stuff.
> >
> > The best way I can imagine do this is by subclassing the text element, and then
> > overloading the toHTML() method to include my link and overloading the _getJS() method to include my
> > JS. I got this idea from looking at Jamie Alessio's advmultiselect... it seems that's how
> > he does it there.
> >
> > But I can't for the life of me find the original toHTML() method that the text
> > element uses! I've searched through its inheritance, and the only toHTML() method I can find is
> > in HTML_Common, and it's essentially blank (virtual method?). So I guess that's not it.
> >
> > Where would be the toHTML() method of a text element that I should use as a template for
> > my custom text element?
> >
>
> Ummm....the direct parent of HTML_QuickForm_text is
> HTML_QuickForm_input which has a toHtml method.
>
Duh. And so it is. It was so small I missed it: 5 lines of code.
Thanks. Happy now.
- -ken
- --
- ---------------
The world's most affordable web hosting.
http://www.nearlyfreespeech.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCFwoke8HF+6xeOIcRAlC6AKDGlP1na973c/l9Zi8RlOe+9j+vkgCfZrvX
4mA7E342wB2GnXcHbwbuq7I=
=TrTe
-----END PGP SIGNATURE-----