e-mail form data

S

Stu

I'm using a script to send form data via e-mail. I would
like to know the format of the "mailto" parameter to send
not all of the form fields but just a selected few????
 
J

Jim Buyens

-----Original Message-----
I'm using a script to send form data via e-mail. I would
like to know the format of the "mailto" parameter to send
not all of the form fields but just a selected few????

What script?

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
S

Stu

This is the mailto paramenter:
<FORM ENCTYPE="text/plain" METHOD='POST'
ACTION='mailto:[email protected]?subject=Balancing
Report?' onSubmit="return submitForm()"
language="JavaScript">

This sends all fields contained in the form. I would like
to send only a few selected fields.
 
J

Jim Buyens

Stu said:
This is the mailto paramenter:
<FORM ENCTYPE="text/plain" METHOD='POST'
ACTION='mailto:[email protected]?subject=Balancing
Report?' onSubmit="return submitForm()"
language="JavaScript">

This sends all fields contained in the form. I would like
to send only a few selected fields.

To get those results, you have to write JavaScript code that
assembles the message body the way you want it, and then JavaScript
code to kick off the mailto operation. Here's an example:

<form method="POST">
<table border="0" cellpadding="2" cellspacing="0" id="table1">
<tr>
<td>Name</td>
<td><input type="text" name="txtName" size="20"></td>
</tr>
<tr>
<td>Address</td>
<td><input type="text" name="txtAddr" size="20"></td>
</tr>
<tr>
<td>Net Worth</td>
<td><input type="text" name="txtNetw" size="20"></td>
</tr>
</table>
<p><input type="button" value="Mail" name="btnMail"
onclick="mailit();"></p>
<script>
function mailit(){
var bod = "Name=" + document.forms[0].txtName.value +
"\nAddr=" + document.forms[0].txtAddr.value +
"\nNetWorth=" + document.forms[0].txtNetw.value;
alert(bod);
window.location.href="(e-mail address removed)" +
"?subject=Balancing Report" +
"?&body=" + bod;
}
</script>

Note that the statement 9 lines from the bottom, beginning "var bod",
assembles the form field values you want, plus any surrounding
chracters, into a string that becomes the body= query string value
for the mailto URL.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
S

Stu

-----Original Message-----
"Stu" <[email protected]> wrote in message

To get those results, you have to write JavaScript code that
assembles the message body the way you want it, and then JavaScript
code to kick off the mailto operation. Here's an example:

<form method="POST">
<table border="0" cellpadding="2" cellspacing="0" id="table1">
<tr>
<td>Name</td>
<td><input type="text" name="txtName"
size="20"> said:
</tr>
<tr>
<td>Address</td>
<td><input type="text" name="txtAddr"
size="20"> said:
</tr>
<tr>
<td>Net Worth</td>
<td><input type="text" name="txtNetw"
size="20"> said:
</tr>
</table>
<p><input type="button" value="Mail" name="btnMail"
onclick="mailit();"></p>
<script>
function mailit(){
var bod = "Name=" + document.forms[0].txtName.value +
"\nAddr=" + document.forms[0].txtAddr.value +
"\nNetWorth=" + document.forms[0].txtNetw.value;
alert(bod);
window.location.href="(e-mail address removed)" +
"?subject=Balancing Report" +
"?&body=" + bod;
}
</script>

Note that the statement 9 lines from the bottom, beginning "var bod",
assembles the form field values you want, plus any surrounding
chracters, into a string that becomes the body= query string value
for the mailto URL.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
.
This is excatly what I was looking for. Thank You.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top