View Full Version : HTML Email Form
njoay
December 10th, 2008, 04:42 PM
After searching and finding nothing I've decided to create a client-side form with simply javascript and html.
The script that I have in the <head> portion:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function initMail(form) {
text = "Check out this page: " + window.location;
form.message.value = "Hi " + form.sendto.value + " (" + form.to.value + "):\n\n"
+ text + "\n\nYour Friend,\n" + form.sendername.value + "(" + form.senderemail.value + ")";
return (form.to.value != "");
}
// End -->
</script>
Then in the <body> I have:
<form name=emailform method=post action="mail.html" target="_new" onSubmit="return initMail(this);">
<input type=hidden name=subject value="** Check Out This Site! **">
<input type=hidden name=message value="">
<table>
<tr><td colspan=2 align=center>Tell a friend about this page!</td></tr>
<tr><td>Their Name:</td><td><input type=text name=sendto></td></tr>
<tr><td>Their Email:</td><td><input type=text name=to></td></tr>
<tr><td>Your Name:</td><td><input type=text name=sendername></td></tr>
<tr><td>Your Email:</td><td><input type=text name=senderemail></td></tr>
<tr><td colspan=2 align=center><input type=submit value="Ok!"></td></tr>
</table>
</form>
The part that I really need help on is the:
<form name=emailform method=post action="mail.html" ...
What is supposed to be in the mail.html file? I would also like a thank you page notifying the sender that the email has been sent. Any help would be greatly appreciated.
Thanks so much!
DDD
December 10th, 2008, 05:12 PM
I would go with a jquery form. But my guess would be you .php file that will actually handle the sending of the email info.
njoay
December 10th, 2008, 05:23 PM
DDD,
thanks for your reply. If could go into detail a little bit more that would really be helpful.
Thanks again
DDD
December 10th, 2008, 05:35 PM
well not too many details I can go into as I am not familiar with your script. But if you google "jquery email form" I am sure you will come up with a wealth of information.
unsolicited advice coming:
Do not under any circumstances use tables for forms... Or I will stick bamboo shoots under your fingernails.
Have a nice day :P
njoay
December 10th, 2008, 05:50 PM
ha-ha! understood about using tables for forms - i'm just trying to get this thing to work. i did google jquery email form but it seems like i'll be having to use PHP which our servers don't support.
any other suggestions? Your help is really appreciated!
Sage_of_Fire
December 10th, 2008, 08:00 PM
By definition, you can't create a client-side email form. You will need a server-side language to receive the input from the form and send it out as an email. If you don't have any form of server scripting language, I suggest you use a mailto: link and tell the clients what information to include.
If you do have access to a server-side language, you'll have to write an email script for that, not javascript. Javascript can check the form fields for validity, construct the form dynamically, and even send the info to the server through an ajax request, but something must be there to receive the input.
njoay
December 11th, 2008, 10:55 AM
Sage of Fire,
thank you for the clarification, I did need that. As much as I would love to use the mailto function, I don't think that would fulfill my bosses' wishes. I am willing to learn any server-side language (except PHP since our servers don't support it) to get this email link to work but I've searched for several days and haven't had any luck with any good or recent tutorials. If you can steer me in the right path or share a good link to learn from I'd really appreciate it!
Thanks so much!
hourang
December 11th, 2008, 11:34 AM
http://www.tizag.com/aspTutorial/aspFormsEmail.php
saxx
December 11th, 2008, 11:53 AM
Unless you use the mailto function, its impossible to send or write files client side. Could you tell us what server-side language your server does support, and maybe we can point you in the right direction.
njoay
December 11th, 2008, 02:33 PM
Unless you use the mailto function, its impossible to send or write files client side. Could you tell us what server-side language your server does support, and maybe we can point you in the right direction.
saxx,
I believer our server supports everything except for PHP. Hope this helps?
hourang,
I'm checking out the link now. Thanks for that!
hourang
December 11th, 2008, 03:08 PM
saxx,
I believer our server supports everything except for PHP. Hope this helps?
hourang,
I'm checking out the link now. Thanks for that!
it should work if your hosting company supports the CDO method. the best way is to go to your hosting companies support pages and see which method they use for asp email.
Syous
December 11th, 2008, 03:31 PM
well not too many details I can go into as I am not familiar with your script. But if you google "jquery email form" I am sure you will come up with a wealth of information.
unsolicited advice coming:
Do not under any circumstances use tables for forms... Or I will stick bamboo shoots under your fingernails.
Have a nice day :P
Tables make forms super easy, why wouldn't you use them? I can understand building an entire site in tables is sort of ridiculous now, but why forms?
nobody
December 11th, 2008, 03:32 PM
Forms aren't tabular data.
You can do it pretty easily with lists.
ramie
December 11th, 2008, 03:34 PM
A list wouldn't exactly be semantically correct either tho would it?
njoay
December 11th, 2008, 04:40 PM
hourang,
The tutorial doesn't work for me. Not sure if our servers support ASP email. Have any others?
Thanks!
DDD
December 11th, 2008, 05:13 PM
Forms aren't tabular data.
You can do it pretty easily with lists.
Not even lists. Just labels and text fields and the normal box model flow. And you can set the tab order for even more control.
hourang
December 12th, 2008, 09:50 AM
hourang,
The tutorial doesn't work for me. Not sure if our servers support ASP email. Have any others?
Thanks!
like i said in my last post it depends on your host. let me know what hosting company you have and ill find out what you need.
hourang
December 12th, 2008, 09:53 AM
another method that might work:
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail")
objCDO.To = "blah@blah.com"
objCDO.From = "webmaster@coolstuff.com"
objCDO.Subject = "this is the subject"
objCDO.Body = "Body here."
objCDO.Send
Set objCDO = Nothing
njoay
December 15th, 2008, 02:26 PM
hourang,
i think our servers can support everything except php. hope this helps? i'll try out your most recent script to see if it works.
thanks so much!
hourang
December 15th, 2008, 05:20 PM
hourang,
i think our servers can support everything except php. hope this helps? i'll try out your most recent script to see if it works.
thanks so much!
just because they support any language besides php doesnt mean they have all the email objects installed. if you just pm me who the provider is, ie godaddy.com i can find out for you what you need to use.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.