With this code, it alerts the user when the form is empty, but still submits it when the user clicks [OK]
<script type="text/javascript" language="JavaScript"> function nameempty() { if ( document.formname.name.value == '' ) { alert('No name was entered!') return false; } } </script> <form action="submit.php" method="post" name="formname" onsubmit="return nameempty();"> <input type="text" name="name" class="textfield"> <input type="submit" value="Submit" name="submit"> </form>