Hello, i would like to know how to to do error validation for listbox.
The form has a textfield, a listbox and submit button(find).
Basically the listbox is populated based on the search input in the texfield.
I would like to know how to add a message eg.( NO MATCH FOUND ) into the listbox when the search returns 0.
Code:
<%@LANGUAGE="VBSCRIPT"%>
<%
'test to see if site is set
TestFile("Add")
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script language="javascript" src="Scripts\fieldcheck.js"></script>
<title>SLID - Select License</title>
</head>
<body onload="document.form1.text1.value=document.form1.option1.options[document.form1.option1.selectedIndex].value">
<%
SubTitle = "Select License"
%>
<DIV align=center>
<form name="form1" method="post" action="">
<P>
Software: <INPUT id=text1 name=text1 size="10">
<input type="submit" name="Submit" value="Find">
<%
on error goto 0
If Request.Form("Submit") = "Find" Then
description = Request.Form("text1")
set rs=Server.CreateObject("ADODB.Recordset")
sql= "select id,description from standard_sw where description like '" & description & "%'" &_
" union " &_
" select id,name from legacy_sw where name like '" & description & "%'"
rs.Open sql,connStrSias
'Response.write "SQL = "&sql
'Response.Write Request.form
response.write "<select id='option1' size='1' name='option1' onchange='this.form.text1.value=this.options[this.selectedIndex].value'>"
while not rs.EOF
response.write("<option value='")
response.write(rs.fields("description"))
response.write("'")
if rs.fields("description")= description then
response.write("selected")
end if
response.write(">")
response.write(rs.fields("description"))
response.write("</option>")
rs.MoveNext
wend
response.write "</select>"
rs.Close
set rs=Nothing
End if
%>
</form></DIV>
<P align=center><INPUT type=submit value=Next name=btnSubmit onclick="verify();">
</body>
</html>
Thanks in advance.