where should place code to pop up an alert if user pushes submit with out selecting anything from the listbox.
Code:
<HTML>
<HEAD>
<TITLE>
Search PAGE
</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function getSelected(opt) {
var selected = new Array();
var index = 0;
for (var intLoop = 0; intLoop < opt.length; intLoop++) {
if ((opt[intLoop].selected) ||
(opt[intLoop].checked)) {
index = selected.length;
selected[index] = new Object;
selected[index].value = opt[intLoop].value;
selected[index].index = intLoop;
}
}
return selected;
}
function outputSelected(opt) {
var sel = getSelected(opt);
var strSel = "";
for (var item in sel)
strSel += sel[item].value + "\n";
alert("Selected Items:\n" + strSel);
}
</SCRIPT>
</HEAD>
<BODY>
<select name="Logicalnm_lst" >
<% int i=0;
while (iter_ln.hasNext()) {
if(i==0) {%>
<option value="selectlst">Select the Logical name
<% i=1;
}
String value = (String)iter_ln.next();
%>
<option value = "<%=value%>"><%=value%></option>
<%
}
%>
</select>
<INPUT TYPE="submit" name="simplesearch" value="Submit" ONCLICK="outputSelected(this.form.Logicalnm_lst.options)">