This code reads two combos and displays the information along with one text box of values. Two combos, one textbox example Here is the code for this Example Page one <!-- Author: Adrian Forbes --> <%
strconn = "Driver={SQL Server};Description=sqldemo;SERVER=127.0.0.1;UID=LoginID; PWD=Password;DATABASE=Database_Name set conn = server.createobject("adodb.connection") conn.open strconn set objRS = createobject("ADODB.Recordset") objRS.Open "select ID, strParent from Parents", strconn
if Request("cboPrimary") = "" then lPrimary = objRS("ID") else lPrimary = clng(Request("cboPrimary")) end if %> <form name=frmTest action="2Combo1TextboxTarget.asp" method=POST> <p> <select name=cboPrimary size=1 onChange="RefreshPage()"> <%while not objRS.EOF lID = clng(objRS("ID"))%> <option value="<%=lID%>"<%if lPrimary = lID then Response.Write " SELECTED"%>><%=objRS("strParent")%> <% objRS.MoveNext wend objRS.Close objRS.Open "select ID, strChild, intValue from Children WHERE intParent=" & lPrimary, strconn %> </select> <select name=cboSecondary size=1" onChange="PopulateTextbox()"> <%while not objRS.EOF lID = clng(objRS("ID"))%> <option value="<%=lID%>"><%=objRS("strChild")%> <% objRS.MoveNext wend %> </select> <input type=TEXT name=txtValue> <p><input type=SUBMIT value="Submit" id=SUBMIT1 name=SUBMIT1> </form> <% objRS.MoveFirst while not objRS.EOF%> <input type=HIDDEN ID="intValue<%=objRS("ID")%>" value="<%=objRS("intValue")%>"> <%objrs.MoveNext wend objRS.Close set objRS.ActiveConnection = nothing set objRS = nothing %>
<form name=frmRefresh action="2Combo1Textbox.asp" method=POST> <input type=HIDDEN name=cboPrimary> <input type=HIDDEN name=cboSecondary> </form>
<script language=VBScript> sub window_onLoad PopulateTextbox end sub
sub PopulateTextbox lID = document.frmTest.cboSecondary.value document.frmTest.txtValue.value = document.all("intValue" & lID).value end sub
sub RefreshPage frmRefresh.cboPrimary.value = frmTest.cboPrimary.value frmRefresh.cboSecondary.value = frmTest.cboSecondary.value frmRefresh.submit end sub </script> Page Two <%@ Language=VBScript %> <HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"> </HEAD> <BODY>
<table border=0> <tr> <td>Primary</td></td><td><%=Request("cboPrimary")%></td> </tr> <tr> <td>Secondary</td></td><td><%=Request("cboSecondary")%></td> </tr> <tr> <td>Value</td></td><td><%=Request("txtValue")%></td> </tr>
</BODY> </HTML> |
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
More Database Code Articles More By Adrian Forbes developerWorks - FREE Tools! | As businesses grow increasingly dependent upon Web applications to provide services to customers, employees and partners, these complex applications become more difficult to secure. Although traditional security solutions protect Internet infrastructure layers, they do not guard against HTTP and HTML attacks. Many organizations that conduct security testing still deploy applications that allow attackers to manipulate their logic and wreak havoc on their business. To mitigate this risk, development and delivery teams must address Web application security throughout the lifecycle, addressing the many layers detailed in this paper. FREE! Go There Now!
| | | | Achieving true agility is a never-ending effort. We will showcase how you can become agile incrementally, a few practices at the time.Which practices should any agile team strive to adopt? What additional practices should you consider based on your needs to scale? Adopting practices are however made much easier with the right tool support. What about if your tools adapt to your practices? We will take a look at how the Jazz technology can be leveraged to make your process change the behavior of your tools. FREE! Go There Now!
| | | | Effective governance for lean development isn’t about command and control. Instead, the focus is on enabling the right behaviors and practices through collaborative and supportive techniques. Hear from Scott Ambler on how it is far more effective to motivate people to do the right thing than it is to force them to do so. Learn how to form a lightweight, collaboration-based framework that reflects the realities of modern IT organizations. FREE! Go There Now!
| | | | In this tutorial, you can learn how to install and configure the IBM Rational Asset Manager Eclipse client, explore the different views in the Asset Management perspective, learn various search techniques, work with existing assets, and submit a new asset. FREE! Go There Now!
| | | | This Fall, IBM Rational talks to you directly through a special teleconference series giving you access to the best minds in IBM Rational - product experts and market thought leaders who will answer your questions during these pre-scheduled telephone conference calls. Register today! FREE! Go There Now!
| | | | Discover how Rational tools and best practices for testing can make your job easier. The new Rational Testing eKits provide you with valuable resources – including demos, webcasts, tutorials, and articles – that help you address your specific testing needs across the software lifecycle. Five new eKits are available covering the topics of Requirements and Test Management, Functional Testing, Performance Testing, Code Quality and Embedded Systems, and SOA and Web Services Testing. FREE! Go There Now!
| | | | Learn the basics of the IBM Customer Information Control System (CICS). With a hands-on exercise, learn how to get your first CICS application up and running on your desktop using TXSeries V6.1 for Windows. The tutorial shows you how to download and install a free trial version of TXSeries V6.1. FREE! Go There Now!
| | | | Informix Dynamic Server (IDS) Express Edition offers outstanding online transaction processing (OLTP) database performance, while helping to simplify and automate many of the tasks associated with deploying databases for small business applications. IDS 11 further extends the ease of management and applications integration with the Admin API and Scheduler, high availability with Continuous Log Restore for backup server recovery in case of a primary server failure, and column level encryption to protect personal and company private data. FREE! Go There Now!
| | | | Visit IBM developerWorks to try the IBM SOA Sandbox for connectivity. The SOA Sandbox for connectivity provides a trial environment with the tooling and components to help you explore how to effectively connect your infrastructure and integrate all of the people, processes and information in your company. Use the hosted sandbox to explore SOA techniques that streamline connecting existing IT assets together, as well as learn how to connect them to new business logic. FREE! Go There Now!
| | | | User communities play an important role in communication and collaboration around products, solutions and other areas of special interest to members. Successful communities are able to provide the right mix of content and services to deliver a value proposition that resonates with each audience. Join Tom Inman, VP of Marketing for Information and Platform Solutions as he introduces the new LeverageINFORMATION community. During this webcast, learn about the value provided by the community and how customers and partners derive value from the community in addressing their own technical and business challenges. FREE! Go There Now!
| | | | All FREE IBM® developerWorks Tools! | |