Difference between revisions of "Smartform Gold"

From rbachwiki
Jump to navigation Jump to search
(Created page with "== Smart Form - Another way to subtotal fields== <pre> Code: echo "hidden"; 6.Insert the static text (<span> element) on the page. 7.Define an id for it: "total_span". 8....")
 
Line 1: Line 1:
== Smart Form - Another way to subtotal fields==
== Smart Form - Another way to subtotal fields==
<pre>
<pre>
 
1.Insert on the page one more field (input, text). 2.Define an id for it: "total".
3.Define a name for it: "total".
4.Open it's MSDN properties->Styles->display.
5.Open a PHP editor for this style and enter:


Code:
Code:

Revision as of 21:03, 8 August 2016

Smart Form - Another way to subtotal fields

1.Insert on the page one more field (input, text). 2.Define an id for it: "total". 
3.Define a name for it: "total". 
4.Open it's MSDN properties->Styles->display. 
5.Open a PHP editor for this style and enter: 

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.