Microsoft Knowledge Base Email Alertz

(191565) - This article explains one possible way to write Active Server Pages (ASP) code using VBScript to provide a recursive functionality within your ASP page.

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 191565 - Last Review: June 29, 2004 - Revision: 2.1

How To Create a Recursive Form Using Active Server Pages

This article was previously published under Q191565

SUMMARY

This article explains one possible way to write Active Server Pages (ASP) code using VBScript to provide a recursive functionality within your ASP page.

MORE INFORMATION

Recursive means that the ASP page calls itself to continue with functionality. In the example below, the page posts form values to itself for processing. This is by no means necessary in all applications; it is merely provided as a more robust method to achieve functionality. One advantage to this method is fewer ASP pages to maintain. For example, a developer can make a self-contained "wizard" all in one ASP page.

This sample demonstrates the functionality with one post to itself.

Paste this code in a plain text document, and save it as "Recursive.asp."
   <%@ LANGUAGE="VBSCRIPT" %>
   <%
      submitted = Request.Form("frmSubmit")
   %>
   <HTML>
   <HEAD>
   <TITLE>Recursive Example</TITLE>
   </HEAD>
   <BODY>
   <%
   If submitted <> "yes" Then
   %>
   <h3>Recursive Example</h3>
   <form action="<%=Request.Servervariables("SCRIPT_NAME")%>" method="post"
                                                             name="myForm">
   <input type="hidden" name="frmSubmit" value="yes">
   Please enter some text:<br><input type="text" name="frmInput"><p>
   <input type="submit" name="myButton" value="Click here to continue">
   </BODY>
   </HTML>
   <%
    ElseIf submitted = "yes" Then
   %>
   <h3>Form Has been submitted</h3>
   This is the information you submitted:<p>
   <%=Request.Form("frmInput")%>
   </BODY>
   </HTML>
   <%
   End If
   %>
				
WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS KB IS AT YOUR OWN RISK. Microsoft provides this code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. Microsoft provides examples of Visual Basic Script procedures for illustration only, without warranty either expressed or implied, including, but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic Script procedures in this article are provided 'as is' and Microsoft does not guarantee that they can be used in all situations. While Microsoft support engineers can help explain the functionality of a particular procedure, they will not modify these examples to provide added functionality, nor will they help you construct procedures to meet your specific needs. If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee-based services, including creating custom procedures. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400.

APPLIES TO
  • Microsoft Visual Basic, Scripting Edition 2.0
  • Microsoft Active Server Pages 4.0
Keywords: 
kbhowto KB191565
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate