View Full Version : mailto does not attach the form information.

10-05-2011, 01: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);

Philip M
10-05-2011, 03:14 PM
The trouble with using this method (mailto) to send form results is its unpredictability. The method it is highly dependent on the browser in use and the email client in use (some people have only Yahoo or Hotmail). In particular, your visitor must have Outlook or Outlook Express as the default client for this to work correctly. Even if your visitor is using Internet Explorer, but the default mail client is different (e.g. Eudora), your mailto form will not work. With all of the browser troubles, you're likely to lose about half of your users' messages. Most of the email clients that can successfully send a mail will prompt the user by a security dialog prior to sending - this can scare many users from continuing.

In fact few browsers these days accept mailto: as a form action. You need a really old browser for it to work as more modern browsers simply open the email program (if any) and ignore the form. If you are going to use a form then use a server-side formmail script as the action - there are several good free ones out there.

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

10-05-2011, 07:57 PM
Thanks, I tried and looked at CGI but had a .exe file to run and that scares me even more.

Any suggestions, in the meantime I am googling "server-side formmail script"


Philip M
10-05-2011, 08:07 PM
For a simple PHP form feedback script see:- http://www.thesitewizard.com/archive/feedbackphp.shtml