Results 1 to 5 of 5

Thread: Form submitting question???

  1. #1
    Join Date
    Jul 2011
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Form submitting question???

    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:

    Code:
    $(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() { 
                    $("#email").focus();
                });
                return false;
            });
    
            $(".close").live('click', function() {
                $(".pop").slideFadeToggle(function() { 
                    $("#contact").removeClass("selected");
                });
                return false;
            });
        });
    
        $.fn.slideFadeToggle = function(easing, callback) {
            return this.animate({ opacity: 'toggle', height: 'toggle' }, "fast", easing, callback);
        };


    Here is the CSS:
    Code:
    a.selected {
      background-color:#1F75CC;
      color:white;
      z-index:100;
    }
    
    .messagepop {
      background-color:#FFFFFF;
      border:1px solid #999999;
      cursor:default;
      display:none;
      margin-top: 15px;
      position:absolute;
      text-align:left;
      width:394px;
      z-index:50;
      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;
    }
    Last edited by jscheuer1; 11-15-2011 at 11:14 AM. Reason: Format

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Click on the 'Send Message' button.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jul 2011
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    But its not sending the message Anywhere???? I want it to go to my email address?

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by shellymabelly83
    HTML Code:
    <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).

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •