Simple Javascript Form Validation

Bookmark and Share

11-06-2007 20:49:32

Description

The Javascript required to show a confirmation popup before a form is submitted allowing the user to cancel the action.


Details

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
<!--
function check_delete()
{
valid = confirm("The item you picked will be permantly deleted from the database. Are you sure?")
return valid;
}
//-->
</script>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
<form name="contact_form" method="post" action="" onsubmit="return check_delete();">

<h1>Please Enter Your Name</h1>

<p>Your Name: <input type="text" name="contact_name"></p>
<p><input type="submit" name="send" value="Send Details"></p>

</form>
</body>
</html>


Tags

javascript  form  validation  delete  check  confirm 

Bookmark and Share

Login

Enter you login details below to sign in to the site.

If you do not have a login you will need to register.

User Name
Password