How do I use ASP to make a model-like dynamically growing form?

Source: Internet
Author: User
Tags count trim
File:dynaform. Asp
<%@ language = vbscript%>
<% Response.Expires = 0%>
<HTML>
<HEAD>
<title>dynamically Growing form</title>
</HEAD>
<BODY>
<%
If Request ("Action") = "Submit The List" Then
' Show what was entered.
Response.Write "<b>here are the Items submitted:</b><br>"
Nitems = Request.Form ("Items"). Count
For I = 1 to Nitems
' Show submitted Items
Response.Write Request.Form ("Items") (I) & "<BR>"
Next
Response.Write Request ("Item") & "<BR>"

Else

' Create ' form from all items. %>
<form action=dynaform.asp method=post>
<B>Items:</B><BR>
<%
Nitems = Request.Form ("Items"). Count
For I = 1 to Nitems
' Show previously submitted Items
Response.Write "<input type=text name=items value=" "& _
Trim (Request.Form ("Items") (I)) & "" ><BR> "
Next

If Request.Form ("Item") <> "Then
' Paint a new input box, and store the old Item in Items collection
Response.Write "<input type=text name=items value=" "& _
Trim (Request.Form ("Item")) & "><BR>"

Response.Write "<p>please Enter an item,<br>"
Response.Write "and submit them one at a time<br>"
Response.Write "by pressing the ADD Item button.<br>"
Response.Write "<input type=text size=50 name=item value=" "" "" > "
Else
' No Item was submitted and don ' t show an error
Response.Write "<p>please Enter an item,<br>"
Response.Write "and submit them one at a time<br>"
Response.Write "by pressing the ADD Item button.<br>"
Response.Write "<input type=text size=40 name=item value=" "" "" ">
<BR> "
End If

%>

<P>
<input type= "Submit" name= "Action" value= "Add Item to List" >
<input type= "Submit" Name= "Action" value= "Submit the List" >
<BR>

<% End If%>

</FORM>
</BODY>
</HTML>


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.