RE: [PEAR] QuickForm: Custom element type needing JavaScript
| From: | Jan Wagner | Date: | Wed, 28 Apr 2004 08:24:15 +0000 |
| Subject: | RE: [PEAR] QuickForm: Custom element type needing JavaScript | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-12180@lists.php.net to get a copy of this message | ||
> > For some elements, like HTMLArea or the one I'm writing for
> > jsCalendar
> > ATM, it is needed to include some custom Javascript that's needed for
> > the elements to be displayed at all.
>
> An alternative to HTML area (I've not tested) is
> http://www.fredck.com/fckeditor/
This one does not work in Mozilla.
> > The possible solutions I see:
> > a) Just make the script inclusion happen for each and
> > every element.
> > This doesn't look nice in the resulting HTML document and also
> > might bring some unwanted side-effects (Javascript bugs).
> > b) Add a method to the element classes that can add global
> > Javascript code for the form object, that will be rendered
> > in front of the whole form output (in other words: the
> > same place
> > where the validation Javascripts go).
> > c) I have missed something :-)
> >
> > Any thoughts on this?
Solution b) would be nice, though it does not solve all problems. With
HTMLArea I have to include a JS file and set some variables. While the
variables can be set with this method, I cannot include the file there.
Either you do that manually or let it do the element itself. So maybe
you could have a qf_html_header or something the like where this can
happen.
> Another function which may be needed is the ability to attach some
> javascript to a form object global variable which can be appended to the
> form, which may execute something once the whole form is loaded in to the
> web browser - useful if your Javascript references multiple form elements.
This would definately be cool (maybe qf_html_footer)
Jan