Solved

Select email address from drop-down box.

Posted on 2001-07-19
8
204 Views
Last Modified: 2010-04-07
I have a Contact Us form and would like to have the email sent to the person that is selected from a drop-down box.

Is there an easy way to do this??? Thanks
0
Comment
Question by:LTurk
  • 5
  • 3
8 Comments
 
LVL 3

Expert Comment

by:MHQ
ID: 6302457
Do you have a cgi or similar to handle to sendinbg of the e-mail or do you mean opening up the visitors mail-program with the correct adress?

/MHQ
0
 

Author Comment

by:LTurk
ID: 6302482
I created most of the site with DreamWeaver but I created the Contact Us Form with Front Page because it is so easy to do in Front Page.  Therefore I didn't have to bother with a cgi.

0
 
LVL 3

Expert Comment

by:MHQ
ID: 6302497
You still need a serverside function to send the mail unless you use the visitors own mailing program. I guess this is what you are planning on doing so let me work out a solution for you.

/MHQ
0
 

Author Comment

by:LTurk
ID: 6302579
I'm still a beginner at web pages so I'm not sure what I need or use. But there's hope - I am signing up for some classes next week:) But in front page all you do is create the form,go into the form properties, and type in the email address of where you want the info to be emailed to. I think i read somewhere that it does create a cgi for you but it is hidden and not something you can edit.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 3

Expert Comment

by:MHQ
ID: 6302600
This should do it for you!

<script>
function mail(tt)
{
if (tt.form.myselect.value!="") {
tt.form.action="mailto:"+tt.form.myselect.value+"?subject="+tt.form.mysubject.value+"&body="+tt.form.themessage.value+"&";
tt.form.submit();
}
 else {
alert("You must choose a recipient!");
}
return false;
}
</script>
<form action="mailto:BobA@yy.com" name=myform>
Recipient:<br>
<select name=myselect>
<option value="">Select a person
<option value=BobA@yy.com>Bob A
<option value=BobB@yy.com>Bob B
<option value=BobC@yy.com>Bob C
<option value=BobD@yy.com>Bob D
</select>
<br>
Subject:<br>
<input type=text name=mysubject>
<br>
Message:<br>
<textarea name=themessage>
Type your message here
</textarea>
<br>
<input type=button value=Send email onclick=mail(this);>
</form>

Regards,
MHQ
0
 

Author Comment

by:LTurk
ID: 6302691
Does all that go into the Submit Button?
0
 
LVL 3

Accepted Solution

by:
MHQ earned 100 total points
ID: 6302729
Copy and paste the code below into the code of new document.

As you can see, I have removed the submit button and andded a regular button instead which calls the function that constructs the message and sends it.

I don't know how used you are to working directly with the code of HTML and javascript, if you need more explanation, just say so.

<html>
<head>
<script>
function mail(tt)
{
if (tt.form.myselect.value!="") {
tt.form.action="mailto:"+tt.form.myselect.value+"?subject="+tt.form.mysubject.value+"&body="+tt.form.themessage.value+"&";
tt.form.submit();
}
else {
alert("You must choose a recipient!");
}
return false;
}
</script>
</head>
<body>
<form action="mailto:BobA@yy.com" name=myform>
Recipient:<br>
<select name=myselect>
<option value="">Select a person
<option value=BobA@yy.com>Bob A
<option value=BobB@yy.com>Bob B
<option value=BobC@yy.com>Bob C
<option value=BobD@yy.com>Bob D
</select>
<br>
Subject:<br>
<input type=text name=mysubject>
<br>
Message:<br>
<textarea name=themessage>
Type your message here
</textarea>
<br>
<input type=button value=Send email onclick=mail(this);>
</form>
</body>
</html>

Regards,
MHQ
0
 
LVL 3

Expert Comment

by:MHQ
ID: 6309332
Glad it worked as you wanted! =)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
This video discusses moving either the default database or any database to a new volume.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now