Javascript: Pop up Message Box On Submit

Description

In this Javascript example, when the user hits the submit button on an order form, a windows style dialog message box pops up, with some disclosure information before the user continues to the next web page.

This process is basically a "Confirm" notice to the user. To make sure the user is responsible for the data being passed. Its a way to put the ownership on the user to verify the data again before submitting.

Javascript Code

Below is the javascript example, to be placed between the <HEAD></HEAD> tags of the document with the submit button.

<SCRIPT LANGUAGE="JavaScript">
      function confirmAction() {
        return confirm('Attention:\nPlease be sure to carefully review your information for typos, as well as proper\ncapitalization, punctuation, sentence case, etc. We do not evaluate or verify the accuracy of\nany and all information entered by the user, and therefore shall not be responsible or liable for said accuracy.' )
      }
   
</SCRIPT>

HTML Form Code:

Below is the HTML/Javascript call for the diaglog message box to display when the form is submitted.

<form action="nextpage.html" method="post" target="_top" name="submitform" onSubmit="return confirmAction()">

<input type="submit" value="Checkout" name="sub">

</form>
 

More by this Author


Click to Rate This Article
working