There is only one required field the 'bu'.
The validation message doesn't display when I submit the search form
if I don't have a 'bu' selected?
---javascript------
<script language='javascript'>
function validate_form(thisform) {
var sMsg='';
var sSel='N';
with (thisform) {
if ( bu.value=='' ) { sMsg+="No bu\r\n"; }
for (i = 1; i < bu.length; i++) {
if ( bu[i].selected) { sSel='Y'; }
}
if ( sSel=='N' ) { sMsg+="No BU selected\r\n"; }
if ( sMsg.length > 0 ) {
alert(sMsg);
return false;
}else{
return true;
}
}
}
</script>
---form-----
echo "<form action='$me' method='post' onsubmit='return validate_form(this);'>";
echo "<td><table cellpadding='3' cellspacing='0' border='0' style='border:1px solid #CCCCCC' align='center'>\n";
echo "<th colspan='2'><span class='ast'></span>Search for Labels to Print\n";
echo "<tr>\n";
echo "<th align='right'><span class='ast'></span>BU\n";
echo "<td><select name='bu'>\n";
get_bu();
echo "<tr>\n";
echo "<th align='right'>Zone ID\n";
echo "<td><input type='text' name='search_zoneid' size='20'>\n";
echo "<tr>\n";
echo "<th align='right'>Zone Number\n";
echo "<td><input type='text' name='search_zonenm' size='20'>\n";
echo "<tr>\n";
echo "<th align='right'>NDC\n";
echo "<td><input type='text' name='search_nationalDrugCode' size='20'>\n";
echo "<tr>\n";
echo "<td align='center' colspan='2'><input type='submit' value='Search'>\n";
echo "</table>\n";
echo "<tr>\n";
echo "<td><span class='ast'>*</span> - <font size='-1'><i>Required</i>\n";
echo "</table>\n";
echo "<tr>\n";
echo "</form>";
thanks,