RE: [PEAR] HTML_quickForm: Seperating JavaScript from html

From: Date: Wed, 12 Oct 2005 17:12:11 +0000
Subject: RE: [PEAR] HTML_quickForm: Seperating JavaScript from html
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21403@lists.php.net to get a copy of this message
Well I think it looks like it works :) When I do this, I'll just pass all the JavaScript to a variable and assign it to a smarty variable that's in my head. Thanks for the idea. I have a question: When you do this: $tFormData = $renderer -> toArray(); $tFormData['javascript'] Does that get ALL the javascript created for all the elements? Or would you need to loop through the array to get each elements javascript? Mark -----Original Message----- From: Damien Cros [mailto:damienc@cc.in2p3.fr] Sent: Wednesday, October 12, 2005 12:53 AM To: Mark Steudel Cc: 'PEAR general list' Subject: Re: [PEAR] HTML_quickForm: Seperating JavaScript from html On 12 oct. 05, at 01:21, Mark Steudel wrote: > I am looking for a way to easily separate the javascript from the > body of > the HTML generated from QuickForm and put it into the head. I am > trying to > use Smarty to accomplish this. I don't want to have to make a > template for > all of the forms as I like they way the look just fine. I just went > to move > the javascript from the body to the head. > > Thanks, mark Hi Mark, Here's what I do to remove the javascript from the html generated by quickform : In my php file: $tFormData = $renderer -> toArray(); $Fnm = "js/quickform.js"; $inF = fopen ($Fnm , "w"); fwrite ($inF , $tFormData['javascript']); fclose ($inF); $tpl -> display('mytemplate.tpl'); then of course i add the following line to my template: <SCRIPT type="text/javascript" src="js/quickform.js"></SCRIPT> I don't know if it works for *every* quickform element, though (especially custom quickform element types) but at least it works for me ;-) Also, I don't know if it's the nicest way to do it. What do you think? bye Damien

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