Order Form with CF4

bachmaier 06 Feb, 2013
Hi,

I am developing an order form (pls see attached picture), where some things have to summed up and so on.

I have managed to fulfill a few of my tasks, e.g. price * quantity. However, i've problems summing all things up at the end of the form. It works when i disable quantity calculation.

This is my js code:
window.addEvent('domready', function() {
  $('epreis1').addEvent('change', epreis1); 
  $('anzahl1').addEvent('change', anzahl1);
});
function epreis1(){
  $('gpreis1').value = $('anzahl1').value * $('epreis1').value ;
}
function anzahl1(){
  $('gpreis1').value = $('anzahl1').value * $('epreis1').value ;
}
window.addEvent('domready', function() {
  $('epreis2').addEvent('change', epreis2); 
  $('anzahl2').addEvent('change', anzahl2);
});
function epreis2(){
  $('gpreis2').value = $('anzahl2').value * $('epreis2').value ;
}
function anzahl2(){
  $('gpreis2').value = $('anzahl2').value * $('epreis2').value ;
}


window.addEvent('domready', function() {
  $('gpreis1').addEvent('change', summe);
$('gpreis2').addEvent('change', summe);
  
});
function summe(){
  $('summe').value = $('gpreis1').value * $('gpreis2').value; // "*" here for testing purpose only
}


Do you see the problem? I've been looking for hours now... :-(
Thank you for your help
Max_admin 07 Feb, 2013
Hello,

My suggestion here would be to use this line of code:

console.log("some_data");
to display some output in the console window (install firebug for firefox), which can help you track the data inside the calculations or events.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.