Select a bunch of the checkbox's and then click submit List of all parents in database, those that are enabled are checked. Select a bunch of the checkbox's and then click submit List of all parents in database, those that are enabled are checked.
Here is the code for this Example Page one the input <%@ Language=VBScript %> <HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"> </HEAD> <title>Multiple checkbox select sample</title> <BODY> <!-- 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, bitEnabled from Parents", strconn %> <p> List of all parents in database, those that are enabled are checked. </p> <form name=frmTest action="MultipleCheckboxesTarget.asp" method=POST> <% iCount = 0 while not objRS.EOF lID = clng(objRS("ID")) iCount = iCount + 1%> <input type=CHECKBOX name=chkParent<%=iCount%> value="<%=objRS("ID")%>"<%if objRS("bitEnabled") then Response.Write " CHECKED" end if%>><%=objRS("strParent")%><br> <% objRS.MoveNext wend objRS.Close set objRS.ActiveConnection = nothing set objRS = nothing %> <input type=HIDDEN name=txtCount value="<%=iCount%>"> <p><input type=SUBMIT value="Select"></p> </form> </BODY> </HTML> Page 2. Shows the Results of what was selected <%@ Language=VBScript %> <HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"> <title>Checkbox selection</title> </HEAD> <BODY> <!-- Author: Adrian Forbes --> <% iCount = Request("txtCount") %> <p> There were <%=iCount%> checkboxes </p> <p> <% for i = 1 to iCount sID = Request("chkParent" & i) if sID = "" then Response.Write "Item " & i & " was NOT checked<br>" else Response.Write "Item " & i & " was checked, it's ID is " & sID & "<br>" end if next %> </p> </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 ASP Code Articles More By aspfree developerWorks - FREE Tools! | Viper 2 brings a great value to developer communities including SQL, XML, PHP, Ruby, .NET and Java. You probably already know that DB2 Express-C is free for developers to develop, deploy and distribute. Viper 2 provides a variety of means that help move your application from the development stage to deployment more rapidly. This webcast shows how to best utilize the latest tools available for developing DB2 applications. FREE! Go There Now!
| | | | This tutorial shows new users of IBM WebSphere Business Monitor Version 6.0.2 how to perform the "Hello World" equivalent for monitoring business process applications. It is intended to help you get familiar with the capabilities of the product. FREE! Go There Now!
| | | | Get a free trial download of the latest version of IBM Rational Functional Tester V7.0.1. Rational Functional Tester is an automated functional and regression testing solution for QA teams concerned with the quality of their Java, Microsoft Visual Studio .NET, and Web-based applications. FREE! Go There Now!
| | | | Download the Rational Application Developer (RAD) v7.5 open beta code and start developing applications for the JEE5 standard which features EJB3.0, JPA, JSF 1.2, JSP 2.1 and Servlet 2.5 standards. When you use this beta you will see how you can increase developer productivity for already existing applications with improved support for refactoring, as well as adding new features to existing applications. In addition, the beta provides tooling for JD Edwards, Oracle, SAP, Siebel and PeopleSoft to improve the developer productivity with these enterprise systems. FREE! Go There Now!
| | | | Whether you are creating new applications or modifying existing ones, managing integration of new components with traditional z/OS elements is a critical part of building and deploying modern applications. Listen to this webcast to see how IBM can help you optimize your development process using an IDE like Rational Developer for System z that integrates with management tools, such as ClearCase to manage your application development on mainframes. 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!
| | | | 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!
| | | | Get a free trial download of the latest version of IBM Rational Tester for SOA Quality V7.0.1, a functional and regression testing tool that enables the creation, comprehension, modification and execution of testing GUI-less Web services. FREE! Go There Now!
| | | | This whitepaper provides areas to consider when evaluating any software configuration management solution. It addresses how the IBM solutions (Rational ClearCase and Rational ClearQuest) meet the needs and requirements of both project leaders and developers to provide successful Software Change and Configuration Management. FREE! Go There Now!
| | | | As organizations integrate software into every aspect of business, they are constantly pressured to deliver faster, better, and cheaper results. Unfortunately, a “dis-integrated” software delivery approach reduces returns while increasing costs. This IBM Rational White Paper shows how Integrated Requirements Management aligns organizations around maximizing value and keeping pace with change. FREE! Go There Now!
| | | | All FREE IBM® developerWorks Tools! | |