Page 1 of 1

[solved] Javascript Issue

Posted: Wed May 19, 2010 1:08 pm
by jchelpdeskwv
Update.  The issue was not at the javascript level but at the form level.  Tiny once again deleted the name of the form.   Now the calculator works.    WATCH OUT FOR TINY!

------------------------------------------------------------------------------------------------------
Issue:
The code below is in my CMSMS page in the Page Specific Metadata section.   While it is not producing errors, it does not calculate the impact fee.  I am using {literal}{/literal}.   Any suggestions?

Working Script at http://www.jeffersoncountywv.org/2008%20rescalc.html

Systen Info:
Cms Version: 1.7
phpversion: 5.3.1
Server Db Type: MySQL (mysql)
Server Db Version: 5.1.41

Code: Select all

{literal}
<__script__>
//this form is for producing NON-BINDING estimates of Impact Fee Payments for Residential Construction.
//The Impact Fee Coordinator for Jefferson County Government (WV) has sole authority to determine the
//actual impact fee payment due.
function calc() {
var curValSchool
var curValLaw
var curValParks
var curValFire
var curNum
var curPresent


	with (document.simple) {
//Determine law enforcement districts
		switch (TaxDistrict.options[TaxDistrict.selectedIndex].value) {
		case "1":
			curLawApplies = "False";
			break;
		case "2":
			curLawApplies = "True";
			break;
		case "3":
			curLawApplies = "False";
			break;
		case "4":
			curLawApplies = "True";
			break;
		case "5":
			curLawApplies = "False";
			break;
		case "6":
			curLawApplies = "True";
			break;
		case "7":
			curLawApplies = "True";
			break;
		case "8":
			curLawApplies = "False";
			break;
		case "9":
			curLawApplies = "True";
			break;
		case "10":
			curLawApplies = "False";
			break;
		}
//determine fee
		curValLaw = 0;
		switch (Residential.options[Residential.selectedIndex].value) {
		case "Single Family Detached":
			curValSchool = 11358;                      //school fee - SF
			curValParks = 752;			  //park fee - SF
			curValFire = 698;			  //fire fee - SF
			if(curLawApplies=="True"){curValLaw=262}; //law fee - SF
			if (document.simple.BeforeApril.checked) //switch for fee increase in Dec 05
	 		   {
			   curValSchool=10655;
			   curValParks = 751;
			   curValFire=603;
			   if(curLawApplies=="True"){curValLaw=135}; 
			   }			
			break;
		case "Town House/Duplex":
			curValSchool = 8560;                     //school fee - TH/D
			curValParks = 575;			 //park fee - TH/D
			curValFire = 533;			 //fire fee - TH/D
			if(curLawApplies=="True"){curValLaw=200}; //law fee - TH/D
			if (document.simple.BeforeApril.checked)
	 		   {
			   curValSchool=8030;
			   curValParks = 574;			 //park fee - TH/D
			   curValFire = 460;			 //fire fee - TH/D
			   if(curLawApplies=="True"){curValLaw=112}; //law fee - TH/D
			   }	
			 break;
		case "Multifamily":
			curValSchool = 6306;                     //school fee - MF
			curValParks = 566;			 //park fee - MF
			curValFire = 525;			 //fire fee - MF
			if(curLawApplies=="True"){curValLaw=197}; //law fee - MF
			if (document.simple.BeforeApril.checked)
	 		   {
			   curValSchool=5916;
			   curValParks = 565;			 //park fee - MF
			   curValFire = 454;			 //fire fee - MF
			   if(curLawApplies=="True"){curValLaw=112}; //law fee - MF
			   }	
			 break;
		}
//determine number of units
		switch (DUCount.options[DUCount.selectedIndex].value) {
		case "1":
			curNum = 1;
			break;
		case "2":
			curNum = 2;
			break;
		case "3":
			curNum = 3;
			break;
		case "4":
			curNum = 4;
			break;
		case "5":
			curNum = 5;
			break;
		case "6":
			curNum = 6;
			break;
		}

	
//calculate fee
	txtSchoolFee.value = "$" + curValSchool * curNum;
	txtLawFee.value = "$" + curValLaw * curNum;
	txtParksFee.value = "$" + curValParks * curNum;
	txtFireFee.value = "$" + curValFire * curNum;	
	txtResult.value = "$" + (curValSchool + curValLaw + curValParks + curValFire) * curNum;
		
					
				}

}

</__script>



{/literal}