Why wont this work? checkFields() iF statment is failing. The select must be set to multiple. Thanks. <form method="POST" action="" name="this_form" onSubmit="return checkFields();"> <select name="this_select[]" multiple> <option value="ts1">ts1</option> <option value="ts2">ts2</option> <option value="ts3">ts3</option> <option value="ts4">ts4</option> </select> </form> Code (markup): <script language="Javascript"> <!-- function checkFields(){ var errormsg = ""; if (document.this_form.this_select.value == "") { var errormsg = errormsg + "Please Select an Value.\n\r"; } if (errormsg != "") { alert(errormsg); return false; } } //--> </script> Code (markup):
You have to validate the value of the selected option, not the <select> element. if (document.this_form.this_select.options[document.this_form.this_select.selectedIndex].value == "") Code (markup):