Added: 24 February, 2008
Group: JavaScript
Creating warning messages in submit forms
Author: Alex
page: 1

Creating warning messages in submit forms

While building complex forms and submit inputs for your web page it is useful to allow users to modify data they have previously entered. That will give your visitors an option to update their info or contact details for example, but that can be potential

Changing of data can be easily managed with forms but when user have option to delete some details about them it can be handy to insert special JavaScript "Are you sure?" alert that will inform user that changes he is about to make cannot be undone.

In creating this simple alert button first step is to place following code into <header>

<script LANGUAGE="JavaScript">
function confirmPost()
var agree=confirm("ARE YOU SURE ?");
if (agree)
return true ;
return false ;
// -->

This JavaScript function confirmPost() handle the situation when user is prompted to answer "Yes" or "Cancel".
If "Yes" is clicked script continues and if user choose "Cancel" form processing is stopped.

Of course you can change the "ARE YOU SURE ?" and write any other warning message.

Next step is placing this JavaScript function into work. In your form you have to create special input tag with onClick event:

<form action="action.php" method="post">
<input type="submit" name="Submit" value="delete" onClick="return confirmSubmit()">

Calling this Javascript with onClick event will be executed if user choose "Yes" and stopped if user choose "Cancel".

As you can see this simple and easy JavaScript can give you way to place extra protection and warning messages while allowing user option to manipulate with submitted data.

GO to: Page 1 : Creating warning messages in submit forms This tutorial is copyrighted. Partial duplication or full duplication is prohibited and illegal. Translation or usage of any kind without authorís permission is illegal.
  • Photo retouch add makeup and create clear face in Photoshop
  • Create low poly house
  • Setting up FTP in windows XP
  • Creating a Flash Photo Slideshow Tutorial
  • Create shadow in Photoshop
  • Drop-Down Menu Tutorial
  • Learn how to create pool in 3D studio
  • Create a realistic chrome car rims
Join our RSS feed
Use our RSS feed to get the latest published tutorials directly to your news reader.
Add to Google
Best tutorials for maya 3d max photoshop and more