Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2002
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How can I CC a user who fills out a form?

    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>

  • #2
    New Coder
    Join Date
    Sep 2002
    Posts
    82
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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>


    Code:
    <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.

    Dale Mitchell

    MindCrafter Web Designs


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •