Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro JSP
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 6th, 2005, 09:44 PM
Authorized User
 
Join Date: Nov 2004
Location: spore, spore, Singapore.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 02:46 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.