Smartform Gold
Jump to navigation
Jump to search
Smart Form - Another way to subtotal fields
Code: echo "hidden"; 6.Insert the static text (<span> element) on the page. 7.Define an id for it: "total_span". 8.Define IDs for your text boxes (e.g. "textbox1", "textbox2", "textbox3"). 9.Add this JS-code in "onchange" event of every text box: Code: calculate(); 10.Open JS ditor and add at the end the following: Code: function calculate(){ var value1 = document.getElementById('textbox1').value; var value2 = document.getElementById('textbox2').value; var value3 = document.getElementById('textbox3').value; if (value1 == '') value1 = '0'; if (value2 == '') value2 = '0'; if (value3 == '') value3 = '0'; var total = parseInt(value1) +parseInt(value2) +parseInt(value3); document.getElementById('total_span').innerHTML=''+total; document.getElementById('total').value=''+total; } After that you will have a capability to insert a value of "total" in your email template through the simple dynamic variable.