You are here: irt.org | FAQ | JavaScript | Form | Q1453 [ previous next ]
Try:
<script language="JavaScript"><!-- function fieldvalidate(formfield) { if (formfield.value.toLowerCase() != 'yes') { alert ('Please enter yes'); formfield.focus(); return false } return true; } //--></script> <form onSubmit="return fieldvalidate(this.form.yesfield)"> <input type="text" onblur="fieldvalidate(this)" name="yesfield"> - enter "yes" to agree. </form>