Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Mar 2012
    Location
    USA
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Want a thank you message to appear after the form has been submitted? How?

    Hello All,

    I have created a form but i am unsure on how to add an a message to appear under the form just to say thank you under the form.
    Last edited by samhor; 01-18-2013 at 01:53 AM.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,917
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Quote Originally Posted by samhor View Post
    Hello All,

    I have created a form but i am unsure on how to add an a message to appear under the form just to say thank you under the form.
    When a form is submitted the page is refreshed. You will need to use server-side coding if you want to display a message after the form submits.


    There are two i's in Hendry, aren't there? - Commentator Radio 5 Live

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    New Coder
    Join Date
    Mar 2012
    Location
    USA
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Quote Originally Posted by Philip M View Post
    When a form is submitted the page is refreshed. You will need to use server-side coding if you want to display a message after the form submits.


    There are two i's in Hendry, aren't there? - Commentator Radio 5 Live
    Thanks.. Just want to keep it simple at the moment.. Maybe in the future

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Flint, Michigan, USA
    Posts
    620
    Thanks
    1
    Thanked 20 Times in 20 Posts
    Code:
    <script type="text/javascript">
    function check() {
      document.forms[0].OK.focus();
      document.forms[0].OK.blur();
      return true;
    }
    </script>
    
    <form ... onsubmit="return check();">
      ...
      <input type="text" id="OK" onblur="location.href='Submitted.htm';" />
    </form>

  • #5
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,618
    Thanks
    0
    Thanked 645 Times in 635 Posts
    Quote Originally Posted by samhor View Post
    Hello All,

    I have created a form but i am unsure on how to add an a message to appear under the form just to say thank you under the form.
    The form will not be on the page after it has been submitted unless you include it in the page that you are submitting it to as well - which is rather pointless unless your server side script needs to display errors.

    To display a thankyou message after the form is submitted simply include that in the HTML of the page that displays after the form is submitted.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

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