Click to See Complete Forum and Search --> : multiple destination email form


alpha channel
09-03-2003, 11:14 AM
I want to make a email form which will allow the user to utilise a drop down to choose the destination for the email and then will fill in their name, subject and message.
I am no programmer but found this free if a little old script which looked just what I wanted. It gives the choice of destination and fills in the subject, but then doesnt fill in the message.
Can anyone see where this is going wrong, or point me in the direction of something with the same sort of inputs, but preferably that will simply send the form rather than producing the usual "mailto:" link?
It needs to be simple!! I have been searching thru the forums but cant see anything as yet.
Thanks!!

<FORM NAME="mailer" METHOD="post" ACTION="" ENCTYPE="text/plain"
onSubmit="(document.mailer.action += mailtoandsubject)">

<!-- Original: Jeff Kieke -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<TABLE BORDER=0>
<TR VALIGN="top">
<TD>Recipient:</TD>
<TD><SELECT NAME="mailtoperson" onChange="msg(this.form)">
<OPTION VALUE="">-- Select --
<OPTION VALUE="person1@aol.com">person1@aol.com
<OPTION VALUE="person2@aol.com">person2@aol.com
<OPTION VALUE="person3@aol.com">person3@aol.com
</SELECT></TD>
</TR>
<TR VALIGN="top">
<TD>Your Name:</TD>
<TD><INPUT TYPE="text" SIZE=45 NAME="name" onChange="msg(this.form)"></TD>
</TR>
<TR VALIGN="top">
<TD>Your Email:</TD>
<TD><INPUT TYPE="text" SIZE=45 NAME="email" onChange="msg(this.form)"></TD>
</TR>
<TR VALIGN="top">
<TD>Priority:</TD>
<TD>
<SELECT NAME="priority" onChange="msg(this.form)">
<OPTION VALUE="Normal">Normal
<OPTION VALUE="Urgent">Urgent
<OPTION VALUE="No Reply Needed">No reply needed
</SELECT></TD>
</TR>
<TR VALIGN="top">
<TD>Subject:</TD>
<TD><INPUT TYPE="text" SIZE=45 NAME="subject" onChange="msg(this.form)"></TD>
</TR>
<TR VALIGN="top">
<TD>Message:</TD>
<TD><TEXTAREA NAME="message" COLS=45 ROWS=5 WRAP="virtual" OnChange="msg(this.form)"></TEXTAREA></TD>
</TR>
<TR>
<TD> </TD>
<TD><INPUT TYPE="submit" VALUE="Send Message">
<INPUT TYPE="reset" VALUE="Reset"></TD>
</TR>
</TABLE>
</FORM>

<SCRIPT LANGUAGE="JavaScript">
function msg() {
document.mailer.action = "mailto:"
mailtoandsubject = ((document.mailer.mailtoperson.options[document.mailer.mailtoperson.selectedIndex].value) + '?subject=' + document.mailer.subject.value);
}
</SCRIPT>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size: 1.78 KB -->

Jona
09-03-2003, 11:53 AM
I'd suggest you try doing it via the server, since those with JavaScript disabled (~13%) and those with Web-based, default email addresses wouldn't be able to submit the form (unless their Web-based email provider also provided them with a program to head for the Web when they clicked mailto: links). Does your server support a server-side language? (If you still would like to do it in JavaScript, just say so, and I'll help.)

[J]ona

alpha channel
09-04-2003, 02:57 AM
Thanks for that - didnt realise about the added complications!
Its not going on my server, so I will need to check out details as to where this is going to be hosted, but its liable to be used by a lot of non professionals all around the world - so probably a high proportion of Web based default email addresses.

Thanks for the help

Jona
09-04-2003, 02:53 PM
Not a problem. :)

[J]ona