You are here: irt.org | FAQ | JavaScript | Form | 3.4 | Q197 [ previous next ]
<script language="JavaScript"><!-- function validate() { if document.myForm.myText.value = '' { alert('Form field blank!'); return false; } else return true; } //--></script> <form name="myForm" onSubmit="return validate()"> <input type="text" name="myText"> <input type="submit"> </form>