...

View Full Version : How can I CC a user who fills out a form?



Howard
09-25-2002, 08:50 PM
I have a form in which the user fills their email address. I want to cc them with the information from the form as well as send it to me.

I have tried the field names of both IsEmail and Email in the mailto cc statement to cc the user with the information they send me with no success at getting a cc to the user. Each time the cc in my email app shows the field name rather than the email name. In the Message area the field name email shows the full email address though. Shown below is the email portion only of the form with the mailto cc identified as whatdoIputhere.
Any solution would be appreciated.
Thanks

<html>
<head>

<script language="JavaScript">

<!-- Begin function resetform() {document.forms[0].elements[0]=="";}
function submitForms() {if ( isEmail())

function isEmail() {
if (document.forms[0].elements[0].value == "") {
alert ("\n The E-Mail field is blank. \n\n Please enter your E-Mail address.")
document.forms[0].elements[0].focus();
return false;
}
// End -->
</script>

<title>Email CC</title>
</head>
<body>

<form enctype="text/plain" name="addform" method='post' action='mailto:myemail@mypo.com?cc=whatdoIputhere&Subject=mailto CC sender' onsubmit="return submitForms()">

<center>
<tr>
<td align=left><b>Email Address</b></td>
<td align=left><input type="text" name="Email" size="25" maxlength="30" ></td>
</tr>

<center>
<input type="submit" value="SEND IT">&nbsp;<input type="reset" value="CLEAR" ></form>

</body>
</html>

aCcodeMonkey
09-25-2002, 11:03 PM
Howard,

The trick is "not" assigning a form action in the html, but assigning the form action dynamically in the javascript.

I simplified the code for the example.

<script language="JavaScript">
function submitForms(){
// Create email address variable
varCC=document.forms[0].elements[0].value;
// Error chack variable value
if (varCC==""){
alert ("\n The E-Mail field is blank. \n\n Please enter your E-Mail address.")
document.forms[0].elements[0].focus();
return false;
}else{
// Assign "action" string to form object
document.forms[0].action='mailto:myemail@mypo.com?cc='+varCC+'&Subject=mailto CC sender'
}
}
</script>




<html>
<head>
<script language="JavaScript">
function submitForms(){
varCC=document.forms[0].elements[0].value;
if (varCC==""){
alert ("\n The E-Mail field is blank. \n\n Please enter your E-Mail address.")
document.forms[0].elements[0].focus();
return false;
}else{
document.forms[0].action='mailto:myemail@mypo.com?cc='+varCC+'&Subject=mailto CC sender'
}
}
</script>
<title>Email CC</title>
</head>
<body>
<form enctype="text/plain" name="addform" action="" method="post" onsubmit="return submitForms()">
<center>
<tr>
<td align=left><b>Email Address</b></td>
<td align=left><input type="text" name="txtEmail" size="25" maxlength="30" value=""></td>
</tr>

<center>
<input type="submit" value="SEND IT"> <input type="reset" value="CLEAR" ></form>

</body>
</html>


Hope this helps. :cool:

Dale Mitchell (acodemonkey@hotmail.com)
MindCrafter Web Designs (http://members.aol.com/mndcrftr)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum