[TYPO3-german] Formhandler mit JS Berechnung durchführen

Bernhard Prange mail at bernhard-prange.de
Wed Mar 5 19:07:04 CET 2014


Hallo Liste,
ich versuche in einem einfachen Formular eine Preisberechnung 
durchzuführen. Leider macht mir da jetzt die Notation von Formhandler 
einen Strich durch die Rechnung (weil ich auch nen JS Napp bin!)

Ich möchte z.B. diesen Input ansprechen:
<input type="text" onblur="stopCalc();" onfocus="startCalc();" value="" 
name="prepurchase_exam[amount01]">

mit:

	<script  type="text/javascript"language="JavaScript">
	<!--
	function startCalc(){
	interval = setInterval("calc()",100);
	}
	function calc(){
	one = (document.prepurchase_exam.price01.value * document.prepurchase_exam.prepurchase_exam[amount01].value);
	document.prepurchase_exam.sum01.value = one;
	two = (document.prepurchase_exam.price02.value * document.prepurchase_exam.amount02.value);
	shipping = (document.prepurchase_exam.Shipping.value);
	document.prepurchase_exam.sum02.value = two;
	document.prepurchase_exam.total.value = (one * 1) + (two * 1) + (shipping * 1);
	}
	function stopCalc(){
	clearInterval(interval);
	}
	//  End -->
	</script>


Leider geht das nicht, denn die [] klammern im Namen erzeugen Ein Problem.

Wie kann ich das vermeiden?

Gruß

Bernhard




More information about the TYPO3-german mailing list