CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Adding Onchange Javascript, But need PHP

Print topic Send  topic

Author Message
Matt
Posted: 12/30/2003, 12:59 PM

I have some onchange javascript that I want to add to my page. However the template page is HTML. How do I get around this limitation? Thanks!

Here is the code:
$sJavaScript = "function Drop1(elem){\n for (var i = document.BugTracking.Application.options.length; i >= 0; i--){ \n document.BugTracking.Application.options = null;\n";
$sJavaScript = $sJavaScript."\n}\n";
$sJavaScript = $sJavaScript."for (var i = document.BugTracking.System.options.length; i >= 0; i--){ \n document.BugTracking.System.options = null;\n";
$sJavaScript = $sJavaScript."\n}\n";
$sJavaScript = $sJavaScript."for (var i = document.BugTracking.Window.options.length; i >= 0; i--){ \n document.BugTracking.Window.options = null;\n";
$sJavaScript = $sJavaScript."\n}\n";
$sJavaScript = $sJavaScript."document.BugTracking.System.options[document.BugTracking.System.options.length] = new Option('[no application selected]','[no application selected]');\n";
$sJavaScript = $sJavaScript."document.BugTracking.Window.options[document.BugTracking.Window.options.length] = new Option('[no system selected]','[no system selected]');\n";
$sJavaScript = $sJavaScript."document.BugTracking.Application.options[document.BugTracking.Application.options.length] = new Option('','');\n";
while(!$Drop2->EOF){ //BEGIN WHILE
$sJavaScript = $sJavaScript."if (elem.options[elem.selectedIndex].value==\"".$Drop2->Fields('PROGRAM')."\"){\n";
$sJavaScript = $sJavaScript."document.BugTracking.Application.options[document.BugTracking.Application.options.length] = new Option('".$Drop2->Fields('APPLICATION')."','".$Drop2->Fields('APPLICATION')."');\n}";
$Drop2->MoveNext();
} //END WHILE
$sJavaScript = $sJavaScript."\n}\n";
echo "\n<SCRIPT LANGUAGE=\"JavaScript\">";
echo "\n".$sJavaScript."\n</SCRIPT>\n";
$sJavaScript = "";
RonB
Posted: 01/01/2004, 7:55 AM

CC or CCS????

in CCS use the set tag action:

global $Tpl;

$sJavaScript = "function Drop1(elem){\n for (var i = document.BugTracking.Application.options.length; i >= 0; i--){ \n document.BugTracking.Application.options = null;\n";
$sJavaScript = $sJavaScript."\n}\n";
$sJavaScript = $sJavaScript."for (var i = document.BugTracking.System.options.length; i >= 0; i--){ \n document.BugTracking.System.options = null;\n";
$sJavaScript = $sJavaScript."\n}\n";
$sJavaScript = $sJavaScript."for (var i = document.BugTracking.Window.options.length; i >= 0; i--){ \n document.BugTracking.Window.options = null;\n";
$sJavaScript = $sJavaScript."\n}\n";
$sJavaScript = $sJavaScript."document.BugTracking.System.options[document.BugTracking.System.options.length] = new Option('[no application selected]','[no application selected]');\n";
$sJavaScript = $sJavaScript."document.BugTracking.Window.options[document.BugTracking.Window.options.length] = new Option('[no system selected]','[no system selected]');\n";
$sJavaScript = $sJavaScript."document.BugTracking.Application.options[document.BugTracking.Application.options.length] = new Option('','');\n";
while(!$Drop2->EOF){ //BEGIN WHILE
$sJavaScript = $sJavaScript."if (elem.options[elem.selectedIndex].value==\"".$Drop2->Fields('PROGRAM')."\"){\n";
$sJavaScript = $sJavaScript."document.BugTracking.Application.options[document.BugTracking.Application.options.length] = new Option('".$Drop2->Fields('APPLICATION')."','".$Drop2->Fields('APPLICATION')."');\n}";
$Drop2->MoveNext();
} //END WHILE
$sJavaScript = $sJavaScript."\n}\n";

$Tpl->SetVar("script1", "<script language=javascript>" .$sJavaScript ."</script>");

Now set {script1} in the html page where you want the code to occur.

RonB

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.