View Full Version : Form submitting question???

11-15-2011, 07:17 AM
I am using this simple form but I cannot figure out how to get it to submit??? It's written in Javascript.

Here is the Javascript:

$(function() {
$("#contact").live('click', function(event) {
$(this).addClass("selected").parent().append('<div class="messagepop pop"><form method="post" id="new_message" action="/messages"><p><label for="email">Your email or name</label><input type="text" size="30" name="email" id="email" /></p><p><label for="body">Message</label><textarea rows="6" name="body" id="body" cols="35"></textarea></p><p><input type="submit" value="Send Message" name="commit" id="message_submit"/> or <a class="close" href="/">Cancel</a></p></form></div>');
$(".pop").slideFadeToggle(function() {
return false;

$(".close").live('click', function() {
$(".pop").slideFadeToggle(function() {
return false;

$.fn.slideFadeToggle = function(easing, callback) {
return this.animate({ opacity: 'toggle', height: 'toggle' }, "fast", easing, callback);

Here is the CSS:

a.selected {

.messagepop {
border:1px solid #999999;
margin-top: 15px;
padding: 25px 25px 20px;

label {
display: block;
margin-bottom: 3px;
padding-left: 15px;
text-indent: -15px;

.messagepop p, .messagepop.div {
border-bottom: 1px solid #EFEFEF;
margin: 8px 0;
padding-bottom: 8px;

11-15-2011, 11:29 AM
Click on the 'Send Message' button.

11-15-2011, 04:38 PM
But its not sending the message Anywhere???? I want it to go to my email address?

11-15-2011, 04:55 PM
<form method="post" id="new_message" action="/messages">the form is being submitted: it is being posted to {yourwebsite}/messages. Do you have a script at that location to receive/process the form submission and send the message to your email? html/javascript can not send emails. You need a server-side script (e.g., php).

11-15-2011, 06:21 PM
You can use HTML and javascript, but it's unreliable. The user must have a default mail program configured. Not everyone does. And if the to email address isn't obfuscated from bots, you're making an invitation to all manner of spammers to email you as well. We can work all that out, except of course for when the user doesn't have a default mail program. So it is as traq says more or less, only it's more like server side is better if you have that available to you. There are third party mail handlers as well, if need be. Even with something server side (third party or on your own server) it's best to make sure neither your email address nor your mailing routine is available to spammers - they might use it to bulk email out their spam.