#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Posts
    12
    Rep Power
    0

    Unhappy


    Is there a JavaScript out there that will allow you to send Form results to an email address based on user selections. For example, if someone picks George from the drop down list (or check box, radio button, whatever) that George will get the form at george@hotmail.com. If the user picks Sally, Sally will receive the form results at sally@hotmail.com. , etc. This is driving me nuts. Front Page doesn't allow for this functionality. Go figure. Hence workarounds. (I have no choice but to use Front Page, since that is what the company is on). Please Help Me !!
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Posts
    1
    Rep Power
    0

    Lightbulb


    Here's one way to do this :


    <script language="JavaScript">
    <!-- hide contents from old browsers

    function mailout()
    {
    var recipient = document.mailer.email.options[document.mailer.email.selectedIndex].value;
    document.mailer.action = "mailto:"+recipient;
    }

    //-->
    </script>

    <form name=mailer method=get>
    <SELECT NAME="email" onChange="mailout()">
    <option value="mike@dewolfe.bc.ca">Mike</option>
    <option value="dewolfe@dewolfe.bc.ca">DeWolfe</option>
    </SELECT>
    <input type=submit value="Send Message">
    </form>


    The mailout() function takes the email address from the "email" dropdown.
    It tags on a "mailto:" at the front and then makes the action of the form equal to "mailtoerson@place.com"
    Every time the user changes this dropdown, they are pointing the action of the form to a new email recipient.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Posts
    12
    Rep Power
    0
    Is there any way to do this without using the mailto function. I'm still using Front Page and don't want to rely on the user to open up their e-mail program. I would preferrably like to send this through Front Page.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Posts
    81
    Rep Power
    14
    If your web server supports the Frontpage Server Extensions you may be able to do this. Just give it a try and see if it works:

    - In Frontpage right-click anywhere in your form and choose Form Properties.

    - Under "Send To", fill in the Email box with the address where you want the email sent.

    You can customize what fields get sent, the format of the message, and more using the Options button in this dialog.
    Robert Dominy
    About Guide for JavaScript
    http://javascript.about.com
    Software Consulting & Development
    http://www.angusog.com
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Posts
    12
    Rep Power
    0

    Smile


    That's not exactly what I'm looking to do. I've already looked into the supported features in Front Page. It doesn't seem to give me exactly what I"m looking for. The way you have described only allows one person to recieve the email, no matter what the user inputs. I don't want to daisy-chain the form either because not everyone needs to receive all e-mails.

    Basically what I'm looking to is send e-mail to specified people based on who is chosen in a drop down menu. For example, if Sue, Sally, and Mark are options in the drop down (or in the form of a check-box, radio button, etc) then the respective person will get the email.

    While doing this I don't want to rely on the users e-mail client. I don't want to rely on the user to do anything "extra" cause we all know what happens when we do that.

    I hope I have futher explained what I want to do. Sorry if I wasn't clear before.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Location
    Dublin
    Posts
    413
    Rep Power
    14
    I've done this before, but not very elegantly...

    You can set up a different page for each person in the drop-down box - then submit to the correct page for the given person.

    So if you have three possible destinations, then you will need to set up three front page docs - each configured for the correct individual. You can then submit / redirect to the relevant one based on the content of the drop-down. Send me your page and I'll send you an example.

    This is far from the best solution. You might consider CDONTS from microsoft, or php (free) as the ideal ways to do this. The front page server extensions are only good for mail a single person - unless you don't mind having several options... and if you use server-side includes to avoid the repetition within the docs, then make sure that the form section comes from the main doc and not the include etc.

    You won't be able to do it from javascript, so the php forum might be a good next port-of-call. Or msdn to search for CDONTS

    Ed.
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Posts
    12
    Rep Power
    0
    I'll try anything at this point. I'm enclosing a test form. Any help you could give me would be great. The drop down box with North America, South America, etc is where I need to decipher where the emails go to. You can use whatever email addresses you want and I can change them for testing purposes. Thanks, in advance, for your help.

    I had to give you the straight code because it wouldn't let me upload any files. Please feel free to email me any results at jkain@colorcon.com. Thanks.

    <html>

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>Contract Services</title>
    </head>

    <body>

    <form method="POST" action="--WEBBOT-SELF--" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1">
    <!--webbot bot="SaveResults" startspan S-Email-Format="TEXT/PRE"
    B-Email-Label-Fields="TRUE" B-Email-Subject-From-Field="TRUE"
    S-Email-Subject="Contract Services Information Request" S-Builtin-Fields
    U-Confirmation-Url="company_info_and_requests/confirm.htm"
    U-File="C:\WINDOWS\Desktop\form_results\contract_services.txt" S-Format
    S-Email-Address="dmarano@colorcon.com" --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot
    bot="SaveResults" endspan --><blockquote>
    <hr>
    </blockquote>
    <blockquote>
    <p>&nbsp;<strong><font face="Garamond">Contract Services</font></strong></p>
    <p><font color="#FF0000" face="Garamond"><strong>*- Fields in bold are required</strong></font></p>
    <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </p>
    <table border="0" width="77%">
    <tr>
    <td width="57%">Region</td>
    <td width="43%"><select name="Region" size="1">
    <option value="North America">North America</option>
    <option value="South America">South America</option>
    <option value="Europe">Europe</option>
    <option value="Asia/Pacific">Asia/Pacific</option>
    <option value="Africa">Africa</option>
    <option value="Middle East">Middle East</option>
    </select></td>
    </tr>
    <tr>
    <td width="57%"><font color="#FF0000"><strong>Country*</strong></font></td>
    <td width="43%"><!--webbot bot="Validation" S-Display-Name="Country"
    S-Data-Type="String" B-Allow-Letters="TRUE" B-Allow-WhiteSpace="TRUE"
    B-Value-Required="TRUE" I-Minimum-Length="4" --><input type="text" name="Country" size="28"></td>
    </tr>
    <tr>
    <td width="57%"><font color="#FF0000"><strong>Name*</strong></font></td>
    <td width="43%"><!--webbot bot="Validation" S-Display-Name="Name"
    S-Data-Type="String" B-Allow-Letters="TRUE" B-Allow-WhiteSpace="TRUE"
    B-Value-Required="TRUE" --><input type="text" name="Name" size="28"></td>
    </tr>
    <tr>
    <td width="57%"><font color="#FF0000"><strong>Title*</strong></font></td>
    <td width="43%"><!--webbot bot="Validation" S-Display-Name="Title"
    S-Data-Type="String" B-Allow-Letters="TRUE" B-Allow-WhiteSpace="TRUE"
    B-Value-Required="TRUE" --><input type="text" name="Title" size="28"></td>
    </tr>
    <tr>
    <td width="57%"><font color="#FF0000"><strong>Company*</strong></font></td>
    <td width="43%"><!--webbot bot="Validation" S-Display-Name="Company"
    S-Data-Type="String" B-Allow-Letters="TRUE" B-Allow-WhiteSpace="TRUE"
    B-Value-Required="TRUE" --><input type="text" name="Company" size="28"></td>
    </tr>
    <tr>
    <td width="57%"><font color="#FF0000"><strong>Department*</strong></font></td>
    <td width="43%"><!--webbot bot="Validation" S-Display-Name="Department"
    S-Data-Type="String" B-Allow-Letters="TRUE" B-Allow-WhiteSpace="TRUE"
    B-Value-Required="TRUE" --><input type="text" name="Department" size="28"></td>
    </tr>
    <tr>
    <td width="57%"><font color="#FF0000"><strong>Phone Number* (Include Country Code and Area
    Code)</strong></font></td>
    <td width="43%"><!--webbot bot="Validation"
    S-Display-Name="Phone Number" S-Data-Type="String"
    B-Allow-Letters="TRUE" B-Allow-Digits="TRUE" B-Allow-WhiteSpace="TRUE"
    S-Allow-Other-Chars="-, ., (, )" B-Value-Required="TRUE" --><input type="text" name="Phone_Number" size="28"></td>
    </tr>
    <tr>
    <td width="57%">Fax Number</td>
    <td width="43%"><input type="text" name="Fax" size="28"></td>
    </tr>
    <tr>
    <td width="57%">E-mail Address</td>
    <td width="43%"><input type="text" name="Email" size="28"></td>
    </tr>
    <tr>
    <td width="57%">Address</td>
    <td width="43%"><textarea rows="2" name="Address" cols="27"></textarea></td>
    </tr>
    </table>
    <p><input type="submit" value="Submit" name="Submit"><input type="reset" value="Reset" name="Reset"></p>
    </blockquote>
    </form>

    </body>

    </html>
  14. #8
  15. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Kuching, Sarawak, EAST MALAYSIA
    Posts
    1
    Rep Power
    0

    How if I display the email address?


    Email to:<script language="javascript">var _u = "something"; var _d = "something.com"; var _l = _u + "@" + _d; var _m = "something@something.com" ; document.write("<a href='mailto:"+_l+"'>"+_m+"</a>");</script>

    Yeah, I know the code above for hide email address from web-bot.... how about if i type the email address at the "var _m" that i bold it?

    the page will display out "Email to : something@something.com", do the web-bot still can capture that email address?

    .... as I know many example as I seen before the "var_m" mostly people fill with example : Click Here To Email Me, or Contact Us and etc.

    if I use email address something@something.com, will web-bot still can spam???
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    MD, USA
    Posts
    35
    Rep Power
    12
    Try to see if you can call this span (sort-of span anyway) elsewhere on the page. If you can, then you can just have javascript re-define everything inside based on which area is selected!

    <!--webbot bot="SaveResults" startspan S-Email-Format="TEXT/PRE"
    B-Email-Label-Fields="TRUE" B-Email-Subject-From-Field="TRUE"
    S-Email-Subject="Contract Services Information Request" S-Builtin-Fields
    U-Confirmation-Url="company_info_and_requests/confirm.htm"
    U-File="C:\WINDOWS\Desktop\form_results\contract_services.txt" S-Format
    S-Email-Address="dmarano@colorcon.com" --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot
    bot="SaveResults" endspan -->


    if you can, have javascript re-write the blue part
  18. #10
  19. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Location
    The Netherlands
    Posts
    328
    Rep Power
    14
    Karate-Chick,

    You shouldn't use Frontpage, because it creates messy, unreliable and browser-dependant code. If you want to use a WYSIWYG editor in the first place you should look into Macromedia Dreamweaver (free trail available).

    _If_ you want to use WYSIWYG you should learn to think for yourself, instead of letting the editor think for you. This means that you should frequently read/edit the raw HTML code and make sure that _you_ are in control of the software and not otherwise. Please note that many experienced professionals make this mistake and initial lazyness can cause a lot of headaches in the future.

    Second, please note that there are two different types of code that can be used in a website: server-side (like PHP or CGI) and client-side (like HTML, JavaScript or Flash). The difference between these two is that the latter is executed by the visitors browser and browser/system dependand. The first however is executed on the server and can only be used if your webhoster supports it.

    Ok, let's go back to your problem.... Because JavaScript is client side, you will not be able to do anything usefull/professionally looking with it when it comes to mailing, because it is client-side (so the mail has to be sent by the visitors PC /E-mail client).

    So you will have to choose: a crappy form or investing some time in a proper server side solution. If you want to do it the right way check what languages are supported by your hosting provider. If PHP is supported you should look into that, because it is very powerfull and relatively easy.

    Then find a PHP mail script (on this forum or hotscripts.com, for instance), adapt it, hack it untill it fits. If you have any problems you will be helped (if you ask it the right way) on the IRC channel #php on irc.freenode.org or this forum.

    Good luck!
  20. #11
  21. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Location
    The Netherlands
    Posts
    328
    Rep Power
    14
    When the company only has access to Frontpage either go for a professional developer or download a free PHP editor and purchase a hosting package that supports PHP to do it yourself.

    Of course you might have to convince your boss (if you have one), but you could always say: "If you want functionaliy X you will have to, otherwise this functionality is not possible/more expensive in time and/or money then switching hosting or hiring a professional".

IMN logo majestic logo threadwatch logo seochat tools logo