Two combos, one textbox example |   |  | | | |
| | |  | ADVERTISEMENT
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now! | |  | | |  |
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! | Hold your calendar on January 30, 2008 for this free webcast on the new i5/OS. Rational's Enterprise Modernization products will be discussed at this webcast as they help to drive the application development environment for this new System i OS. <br />And learn how i5/OS will take you to the next step of efficient, resilient business processing. You will hear about the new i5/OS capabilities as it will be the most significant i5/OS release in years. If you cannot join the webcast on 1/30/08 you can still use this link to listen to the replay.<br /> 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!
| | | | When you create browser-based applications that display XML data feeds, you often need to code the data-retrieval mechanism and the user interface. Mozilla Firefox provides an infrastructure that frees you from these tasks, so you can concentrate on your application's functionality. Learn how to use Asynchronous JavaScript + XML (Ajax) to download XML data from a Web server, and discover how you can use Extensible Stylesheet Language Transformations (XSLT) to transform it dynamically into Firefox user-interface elements expressed in XML User Interface Language (XUL). You can apply these techniques to any application that uses XML data sources. FREE! Go There Now!
| | | | Asset Reuse is a key strategy for companies looking to create innovative solutions to solve complex software development problems. Searching for, identifying, updating, using and deploying software assets can be a difficult challenge. Listen to this webcast, to learn about strategies and tools that you can leverage for a successful project, including Rational Asset Manager, Rational Software Architect and WebSphere Service Registry and Repository. FREE! Go There Now!
| | | | To create, test, and deploy a Web-based application or Web service rapidly, you need a proven relational database, a standards-compliant Web application server, and a flexible IDE. Ideally, all these software packages are production-tested, simple to obtain, easy to use, and well integrated with one another. This tutorial shows you how to use IBM-backed open source and free software to kick-start your Java Web-based application development. You'll learn exactly where to download such components, install them, and get them working for you today. FREE! Go There Now!
| | | | Learn how to do more with your reusable assets with the free Rational Asset Manager eKit. The eKit includes demos on how Rational Asset Manager tracks and audits your assets in order to utilize them for reuse. Plus you’ll find white papers and a Webcast that discuss the challenges of a Service Oriented Architecture and how Rational Asset Manager can provide quick and effective solutions. FREE! Go There Now!
| | | | Rational Modeling Extension for Microsoft .NET enhances usability for code generation supporting a more intelligent refactoring. The latest enhancements enable organizations with Java and .NET systems and software development maintain architectural integrity across heterogeneous platforms. 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!
| | | | It's a good time to be a Web developer. You've never had more choices in terms of technologies. There are so many great open source Web servers, databases, programming languages, and development frameworks. No matter what combination of technologies you prefer to work with, there is a single integrated development environment (IDE) that can increase your productivity: Eclipse. Here in Part 3, we introduce the RDT and RadRails Eclipse plug-ins and show you how to get these plug-ins and start using them. You will learn how to use RadRails to do many common Ruby on Rails development tasks. 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! | |
| | | | | | | |  | | | |