Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Passing an email address, supplied by the user, into the CC field..?

  1. #1
    Join Date
    Oct 2005
    Location
    Liverpool, UK
    Posts
    87
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question Passing an email address, supplied by the user, into the CC field..?

    Hi,

    I'm using a company standard .asp mailing form though I'd like to be able to put a value into the cc field based on content entered by the user on the form itself.

    e.g. "If you'd like to receive a copy of this form, please enter your email address here".., etc.

    Is it possible to pass this value back and put it into the code as a variable?
    I've tried the following, but it doesn't seem to work....

    (within the table)
    <textarea name="email_copy" rows="1" cols="50"
    wrap=virtual>???name here???@email.address.com</textarea>

    then...

    <input type="hidden" name="mailcc" value=email_copy>

    Any help on this would be really appreciated !

    Thanks in advance,

    N.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Maybe you could give us the code?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Oct 2005
    Location
    Liverpool, UK
    Posts
    87
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question

    Ok,
    Here we go... I've reduced the Form down to save time...


    <BODY>
    <form method="post" action="/lib/common/mailing.asp">

    <table width=100%>

    <tr>
    <td valign=top align=left><tt><b>Enter your email address to receive a copy (recommended!) of your request:</b>
    </tr>

    <tr>
    <td valign=top><textarea name="email_copy" rows="1" cols="50" wrap=virtual>@email.co.uk</textarea><br></td></tr>
    </table>

    <input type="hidden" name="mailto" value="email@address.co.uk">
    <input type="hidden" name="mailcc" value=email_copy><!-- <input type="hidden" name="mailbcc" value=""> -->

    <input type="hidden" name="mailsubject" value="Form">
    <input type="hidden" name="htmloutput" value="yes">

    <input type="hidden" name="orderby" value="Name,Dept,Telephone_number,Choices,Checkbox 1,Checkbox 2,Comments">
    <input type="hidden" name="senttext" value="Your form has been sent. We will contact you as soon as possible.">

    <table width="100%">
    <tr>
    <td valign="top">Name:</td>
    <td><input name="Name" size="30" style="FONT-FAMILY: Verdana; FONT-SIZE: 10pt" ></td>
    </tr>
    <tr>
    <td valign="top">Dept:</td>
    <td><input name="Dept" size="30" style="FONT-FAMILY: Verdana; FONT-SIZE: 10pt" ></td>
    </tr>

    .... other FORM elements....

    <input type="submit" value="Send"></p></td>
    </tr>
    </table></form>

    </body>
    </html>



    Any thoughts .... ?

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    No, it's not the form I need, it's the contents of /lib/common/mailing.asp
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Oct 2005
    Location
    Liverpool, UK
    Posts
    87
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question

    I cannot easily get hold of that I'm afraid.

    Thinking on, is there some way of passing a value (maybe via JS?) - using on Submit?

    Thanks again in advance,

    N.

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Ah, I think I see: You want to copy the value of one textarea to another? That's more easily done.
    Code:
    <script type="text/javascript">
    var copying = false;
    
    function copy(formNum, fromName, toName) {
      if(!copying) return;
      var from = document.forms[formNum].elements[fromName],
        to = document.forms[formNum].elements[toName];
      to.value = from.value;
      window.setTimeout("copy('" + formNum + "', '" + fromName + "', '" + toName + "')", 300);
    }
    
    function beginCopy(formNum, fromName, toName) {
      copying = true;
      copy(formNum, fromName, toName);
    }
    
    function endCopy() {
      copying = false;
    }
    </script>
    <textarea name="email_copy" onkeydown="beginCopy(0, this.name, 'mailcc');" onkeyup="endCopy();" rows="1" cols="50" wrap=virtual>@email.co.uk</textarea><br></td></tr>
    </table>
    
    <input type="hidden" name="mailto" value="email@address.co.uk">
    <input type="hidden" name="mailcc" value="email_copy">
    Last edited by Twey; 04-18-2006 at 04:32 PM.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Oct 2005
    Location
    Liverpool, UK
    Posts
    87
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Smile

    Brilliant - It works a treat!

    Thank you Twey !!!

  8. #8
    Join Date
    Oct 2005
    Location
    Liverpool, UK
    Posts
    87
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question

    TWEY/All,

    I've been using the below code - changing it slightly, this time, to copy a value into the subject field instead. This then makes the email trail easier to view in the INBOX, for the user, as the subject reads something they quickly recognise. What I'd like to know is how can I join another value to it?

    eg., the subject will be

    "my bit of text" + the value copied from projectname

    So, somehow I need to adjust:
    <input type="hidden" name="mailsubject" value="projectname">


    To capture the input from the user...
    <input type="text" name="projectname" onkeypress="return handleEnter(this, event)" onkeydown="beginCopy(0, this.name, 'mailsubject');" onkeyup="endCopy();" class="memorize" value="1-" size="16" MAXLENGTH=8>


    Thanks in advance,

    N.



    As a reminder...

    The original code supplied by TWEY
    <script type="text/javascript">
    var copying = false;

    function copy(formNum, fromName, toName) {
    if(!copying) return;
    var from = document.forms[formNum].elements[fromName],
    to = document.forms[formNum].elements[toName];
    to.value = from.value;
    window.setTimeout("copy('" + formNum + "', '" + fromName + "', '" + toName + "')", 300);
    }

    function beginCopy(formNum, fromName, toName) {
    copying = true;
    copy(formNum, fromName, toName);
    }

    function endCopy() {
    copying = false;
    }
    </script>
    <textarea name="email_copy" onkeydown="beginCopy(0, this.name, 'mailcc');" onkeyup="endCopy();" rows="1" cols="50" wrap=virtual>@email.co.uk</textarea><br></td></tr>
    </table>

    <input type="hidden" name="mailto" value="email@address.co.uk">
    <input type="hidden" name="mailcc" value="email_copy">


    (Apologies, though this is really JScript - I've left this in the ASP section where it was originally posted).

  9. #9
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    var copying = false;
    
    function copy(formNum, fromName, toName, prefix) {
      if(!copying) return;
      var from = document.forms[formNum].elements[fromName],
        to = document.forms[formNum].elements[toName];
      to.value = (prefix ? prefix : "") + from.value;
      window.setTimeout("copy('" + formNum + "', '" + fromName + "', '" + toName + "'" + (prefix ? ", '" + prefix + "'" : "") + ")", 300);
    }
    
    function beginCopy(formNum, fromName, toName, prefix) {
      copying = true;
      copy(formNum, fromName, toName, prefix);
    }
    
    function endCopy() {
      copying = false;
    }
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  10. #10
    Join Date
    Oct 2005
    Location
    Liverpool, UK
    Posts
    87
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the response! From this code, can you please highlight which prefix ? text parts I should be changing to my required prefix text?

    I think I'm doing it wrong !

    Thanks again!

    N.

Bookmarks

Posting Permissions

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