I am trying to validate if a combo box has been selected..
Here is the code
<script type="text/javascript">
function validate_required(field,alerttxt)
{
with (field)
{
if (value=="[Select]")
{alert(alerttxt);return false}
else {return true}
}
}
function validate_form(thisform)
{
with (thisform)
{
if (validate_required(Department,"Please Select a Department")==false)
{Department.focus();return false}
}
}
</script>
The Code works great for a textbox....But this combo box does nothing. The name of the Combo box is Department and the default value is [Select] I also, addded the code onsubmit="return validate_form(this)" where the form name is.
Thanks for any help
Here is the code
<script type="text/javascript">
function validate_required(field,alerttxt)
{
with (field)
{
if (value=="[Select]")
{alert(alerttxt);return false}
else {return true}
}
}
function validate_form(thisform)
{
with (thisform)
{
if (validate_required(Department,"Please Select a Department")==false)
{Department.focus();return false}
}
}
</script>
The Code works great for a textbox....But this combo box does nothing. The name of the Combo box is Department and the default value is [Select] I also, addded the code onsubmit="return validate_form(this)" where the form name is.
Thanks for any help