I'm using this guide to add a calculation in a form that takes a price, multiplies it by a quantity (set by dropdown) and outputs to a total.
My final code is this:
function totalQuantity(){
getPrice_6();
//calculate a grand total based on the available product field
quantity = parseInt(document.getElementById('quantity').value);
//retrieve the value selected in the "quantity" field
currentTotal = parseFloat(document.getElementById('total').value);
//adjust displayed total
total = quantity * currentTotal;
//re-calculate the total based on the value selected in the "quantity" field
document.getElementById('total').value = total.toFixed(2);
//convert the "total" field's value to a float number followed by 2 decimals
document.getElementById('payment_total_6').innerHTML = total.toFixed(2) + ' AUD';
//display the total field's value along with the "USD" currency code
document.getElementsByName('form[rsfp_Total]')[0].value = total.toFixed(2);
return true;
}
window.addEvent('domready', function() {
totalQuantity();
});
However on changing the quantity field I get a console error: Uncaught ReferenceError: getPrice_6 is not defined.
As per the guide, '6' is the ID of the form I'm using.
It seems like I've missed something obvious, but I can't figure out what.