View Full Version : Combox Question

12-20-2011, 03:47 PM
Hi There,

I need your help.

What would be the Javascript code,

to check a if a selection has been made in a particular combox? and if a selection has not been made, to alert the user that they must select a value from the drop down box.

Much thanks and appreciation for all your help.



12-20-2011, 04:00 PM
something like the following:

<form onsubmit="return validate(this);">
<option value="default">select a value</otion>
<option value="sdasdf">sdasdf</otion>
<option value="sdasdf">sdasdf</otion>
<option value="sdasdf">sdasdf</otion>
<input type="submit" value="submit" />

<script type="text/javascript">
function validate(formObj)
if (formObj.getElementsByTagName('select')[0].value == 'default')
alert('you must select a value from the drop down menu');
return false;
return true;