hans_cellc
10-05-2011, 12:03 PM
Attached is the code. It does open the email but does not send any information.
Can someone please assist.
<!-- Table 2 for the Content -->
<form name="orders" onsubmit="return confirmSubmit()" onreset="return window.confirm('Are you sure you want to reset your Orders.'); " action="mailto:lynette@sayorkies.co.za" method="post" enctype="text/plain">
// Function to Confirm certain conditions and confirm to proceed with order
function confirmSubmit() {
var itemsOrdered = true;
if (document.forms[2].totalExcl.value == 0 || document.forms[2].delivery.value == 0) {
itemsOrdered = false;
}
if(itemsOrdered != true) {
window.alert("You have not chosen any products to purchase or No Delivery Option selected.");
return false;
}
var submitOrder = window.confirm("Are you sure you want to place the order?");
if(submitOrder == true)
return true;
return false;
}
// Function to calculate order value
function calculateValue(orders) {
var orderValue = 0;
// Run through all the product fields
for(var i = 0; i < orders.elements.length; ++i) {
// Get the current field
var formField = orders.elements[i];
// Get the fields name
var formName = formField.name;
// Is it a "product" field?
if (formName.substring(0,4) == "prod") {
// Items price extracted from name
var itemPrice = parseFloat(formName.substring(formName.lastIndexOf("_") + 1));
// Get the Quantity
var itemQuantity = parseInt(formField.value);
// Update the OrderValue
if(itemQuantity >= 0) {
orderValue += itemQuantity * itemPrice;
}
}
}
// Display the totals
orders.totalExcl.value = "R " + orderValue.toLocaleString();
// function to calculate VAT at 15% as required and total inclusive.
function calcTotals(oValue) {
var vat = oValue * .15;
var totalIncluding = oValue + vat;
var tDelivery = Number( orders.delivery.value.substring(2) );
var theTotalOrder = totalIncluding + tDelivery;
orders.vat.value = "R " + vat.toLocaleString();
orders.totalIncl.value = "R " + totalIncluding.toLocaleString();
orders.totalOrder.value = "R " + theTotalOrder.toLocaleString();
}
return calcTotals(orderValue);
}
Can someone please assist.
<!-- Table 2 for the Content -->
<form name="orders" onsubmit="return confirmSubmit()" onreset="return window.confirm('Are you sure you want to reset your Orders.'); " action="mailto:lynette@sayorkies.co.za" method="post" enctype="text/plain">
// Function to Confirm certain conditions and confirm to proceed with order
function confirmSubmit() {
var itemsOrdered = true;
if (document.forms[2].totalExcl.value == 0 || document.forms[2].delivery.value == 0) {
itemsOrdered = false;
}
if(itemsOrdered != true) {
window.alert("You have not chosen any products to purchase or No Delivery Option selected.");
return false;
}
var submitOrder = window.confirm("Are you sure you want to place the order?");
if(submitOrder == true)
return true;
return false;
}
// Function to calculate order value
function calculateValue(orders) {
var orderValue = 0;
// Run through all the product fields
for(var i = 0; i < orders.elements.length; ++i) {
// Get the current field
var formField = orders.elements[i];
// Get the fields name
var formName = formField.name;
// Is it a "product" field?
if (formName.substring(0,4) == "prod") {
// Items price extracted from name
var itemPrice = parseFloat(formName.substring(formName.lastIndexOf("_") + 1));
// Get the Quantity
var itemQuantity = parseInt(formField.value);
// Update the OrderValue
if(itemQuantity >= 0) {
orderValue += itemQuantity * itemPrice;
}
}
}
// Display the totals
orders.totalExcl.value = "R " + orderValue.toLocaleString();
// function to calculate VAT at 15% as required and total inclusive.
function calcTotals(oValue) {
var vat = oValue * .15;
var totalIncluding = oValue + vat;
var tDelivery = Number( orders.delivery.value.substring(2) );
var theTotalOrder = totalIncluding + tDelivery;
orders.vat.value = "R " + vat.toLocaleString();
orders.totalIncl.value = "R " + totalIncluding.toLocaleString();
orders.totalOrder.value = "R " + theTotalOrder.toLocaleString();
}
return calcTotals(orderValue);
}