Script Categories

Forms >>> Required Fields.

Checks form fields to verify that each specified field is not left empty. Displays a warning message if any empty fields are present.

First Name
Last Name

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
function verify() {
var themessage = "You are required to complete the following fields: ";
if (document.form.first.value=="") {
themessage = themessage + " - First Name";
if (document.form.last.value=="") {
themessage = themessage + " -  Last Name";
if ("") {
themessage = themessage + " -  E-mail";
//alert if fields are empty and cancel form submit
if (themessage == "You are required to complete the following fields: ") {
else {
return false;
//  End -->
<form  name=form method="post" action="">
type=text name="first" size="20"> First Name<BR>
<input type=text name="last" size="20"> Last Name<BR>
<input type=text name="email" size="20"> E-Mail<BR><BR>
<input type=button value="Submit Request" onclick="verify();">

type=reset value="Clear Form"><br>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.

Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).