Wrox Programmer Forums
|
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 6th, 2005, 09:44 PM
Authorized User
 
Join Date: Nov 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to vanjamier Send a message via AIM to vanjamier Send a message via MSN to vanjamier Send a message via Yahoo to vanjamier
Default Listbox

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.
__________________
Education ruined me





Similar Threads
Thread Thread Starter Forum Replies Last Post
ListBox obrienkev C# 2005 4 November 6th, 2007 03:15 AM
multiple Listbox values in another listbox terryv Excel VBA 0 June 27th, 2007 07:01 AM
ListBox kanoorani Beginning VB 6 4 September 12th, 2006 12:28 PM
About listbox csc820203 C# 1 April 29th, 2004 06:17 AM
I'm back :) Listbox var from listbox MichaelTJ .NET Web Services 2 October 21st, 2003 07:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.