Can someone point me in the right direction of how to add Sales Tax to the RSJoomla example of the Custom Paypal form. It wont accept the built in Paypal Option to add Sales Tax to the Total since the code does not update. I want to add the Sales Tax of 13% in a hidden field then pass the value to the Grand Total. That probably means that I have to transfer whatever product is selected to the same value SelectedProduct then multiply by 13%
demo.rsjoomla.com/custom-paypal-form-example
here is the original RSform code.
<script type="text/javascript">
function enableQuantity(prod,quantity)
{
if(document.getElementById(prod).checked)
document.getElementById(quantity).disabled = false;
else
document.getElementById(quantity).disabled = true;
calculateTotal();
}
function calculateTotal()
{
var products = new Array("Product10","Product20","Product30");
var i=0;
var total = 0;
for(i;i<products.length;i++)
if(document.getElementById(products
).checked)
{
//alert(document.getElementById("QuantityProd"+(i+1)).value);
total = total + parseInt(document.getElementById(products).value) * parseInt(document.getElementById('QuantityProd'+(i+1)).value);
}
document.getElementById('Total').value = total;
}
</script>
<div class="componentheading">{global:formtitle}</div>
{error}
<table border="0">
<tr>
<td colspan="3">{header:body}<div class="formClr"></div>{header:validation}</td>
</tr>
<tr>
<td>{FirstName:caption}</td>
<td>{FirstName:body}<div class="formClr"></div>{FirstName:validation}</td>
<td>{FirstName:description}</td>
</tr>
<tr>
<td>{LastName:caption}</td>
<td>{LastName:body}<div class="formClr"></div>{LastName:validation}</td>
<td>{LastName:description}</td>
</tr>
<tr>
<td>{Email:caption} (*)</td>
<td>{Email:body}<div class="formClr"></div>{Email:validation}</td>
<td>{Email:description}</td>
</tr>
</table>
<table style="margin-top:10px; margin-left:30px;">
<tbody>
<tr>
<td>{Product1:body}<div class="formClr"></div>{Product1:validation}</td>
<td>{QuantityProd1:body}<div class="formClr"></div>{QuantityProd1:validation}</td>
<td>{QuantityProd1:caption}</td>
</tr>
</tbody>
<tbody>
<tr>
<td>{Product2:body}<div class="formClr"></div>{Product2:validation}</td>
<td>{QuantityProd2:body}<div class="formClr"></div>{QuantityProd2:validation}</td>
<td>{QuantityProd2:caption}</td>
</tr>
</tbody>
<tr>
<td>{Product3:body}<div class="formClr"></div>{Product3:validation}</td>
<td>{QuantityProd3:body}<div class="formClr"></div>{QuantityProd3:validation}</td>
<td>{QuantityProd3:caption}</td>
</tr>
</tbody>
</table>
<table style="margin-top:10px">
<tr>
<td>{Total:caption}</td>
<td>{Total:body}<div class="formClr"></div>{Total:validation}</td>
<td>{Total:description}</td>
</tr>
<tr>
<td>{Submit:caption}</td>
<td>{Submit:body}<div class="formClr"></div>{Submit:validation}</td>
<td>{Submit:description}</td>
</tr>
</table>
<script type="text/javascript">
enableQuantity('Product10','QuantityProd1');
enableQuantity('Product20','QuantityProd2');
enableQuantity('Product30','QuantityProd3');
</script>