I have a form that uses a select box (multiple). When the users hits the 'Go' button, I need to make sure that the user selected at least 1 value from the select box. If they did, I need to process my form, otherwise display alert and cancel.
<html>
<head>
<html>
<head>
<title>Student Schedule</title>
<script type="text/javascript">
function fillFields(form){
var a = form.p_sched_value.value;
}
</script>
</head>
<form name="maint_student_schedule" onSubmit="fillFields(this)" action="stars3.star_portal.process_student_schedule" method="post">
<table width="100%" border="0" cellspacing=0 cellpadding=2 id="student_schedule">
<TBODY>
<table ALIGN="LEFT"><br><tr>
<td ALIGN="RIGHT"> <font CLASS="PortletText1">
<select name="p_sched_value" id="sched_choice1" SIZE="3" MULTIPLE>
<option value=~~~~~~~~~~~~~01>01   (07:59-08:44)
<option value=~~~~~~~~~~~~~02>02   (08:45-09:25)
<option value=~~~~~~~~~~~~~03>03   (09:25-10:10)
</select>
</td>
<td ALIGN="CENTER"><input type="submit" name="p_action" value="Go">
</tr>
</table>
</tbody>
</form>
</table>
<html>
<head>
<html>
<head>
<title>Student Schedule</title>
<script type="text/javascript">
function fillFields(form){
var a = form.p_sched_value.value;
}
</script>
</head>
<form name="maint_student_schedule" onSubmit="fillFields(this)" action="stars3.star_portal.process_student_schedule" method="post">
<table width="100%" border="0" cellspacing=0 cellpadding=2 id="student_schedule">
<TBODY>
<table ALIGN="LEFT"><br><tr>
<td ALIGN="RIGHT"> <font CLASS="PortletText1">
<select name="p_sched_value" id="sched_choice1" SIZE="3" MULTIPLE>
<option value=~~~~~~~~~~~~~01>01   (07:59-08:44)
<option value=~~~~~~~~~~~~~02>02   (08:45-09:25)
<option value=~~~~~~~~~~~~~03>03   (09:25-10:10)
</select>
</td>
<td ALIGN="CENTER"><input type="submit" name="p_action" value="Go">
</tr>
</table>
</tbody>
</form>
</table>