JavaScript Required Field v.3


This script will remind you by occupying the value of a form field, if you do not fill in a required field. Very useful, because other then the alert function, the reminder will stay displayed until the user fills in the required field.

If you decide you want to use or alter the script to suit your needs, please give your support and leave a link to this site,thanks.


Your name (*)

Your E-mail address (*)

       (*) Required


Script Source


<The form >

<form action="" method="post" name="form1" onsubmit="return checkForm();">
<legend>Your name</legend><p>
<input type="text" name="name" size="20">
<legend>Your E-mail address</legend><p>
<input type="text" name="email" size="25">
<p><input type="submit" value="Try it!"><input type="reset" /></P>


<The JavaScript >

<script type="text/javascript">

<!-- Hide from old browsers

// Script by
// If you are using this code please leave
// a link to

function checkForm() {

if ( == "" || == "** Required **") {"** Required **";;;
return false;


else if ( == "" || == "** Required **") {"** Required **";;;
return false;


return true;



Please let me know if this script was helpful to you.