How can I use ASP to create a page similar to the installation wizard?
What are the main problems:
1. The interface is exactly the same as a Windows wizard, with the next and Back buttons
2. You can use the back button to return to any previous step and change the selected content in any previous step.
3. Form must remember all entered content
4. Database unavailable
5. Sessions cannot be used to prevent the loss of all user input after sessiosn becomes invalid. Unfortunately, the cookie cannot be used.
Because many support the cookie option that often disables browsers.
6. Portability is better, because it must adapt to different installation steps
Solution:
1. Use the Hidden variable to pass Parameters
2. Use post instead of get because this method is subject to the length limit.
3. Each page must have a function to read the submitted value.
4. Each page (except the first page) must have a hidden form to pass parameters on the previous page.
If checkboxes is used on your page or radio buttons is used, use the followingCodeRead value:
<% For each item in request. Form
If request. Form (item). Count then
For intloop = 1 to request. Form (item). Count
Response. Write "item =" & item & "Index =" & intloop & "<br>"
Next
Else
Response. Write "item =" & item & "<br>"
End if
Next
%>
In the design, special methods are used for checkboxes and Radio:
1. Only the latest values are considered to be saved using these two methods.
2. You can use back to change the preceding value. However, you must use next to submit the value before it takes effect.
3. The page must be able to cope with the situation where one page has multiple controls
Implementation Method:
The Nth page should include:
1. First form: its action = page (n + 1). asp and it must have the next button at the bottom
2. The second form: its action = page (N-1). asp and Back buttons
3. Variable naming rules: for example, N _ <Page No> the suffix is the control type. <input type = radio name = radio_p2>
Yes. One name on the second page is radio.
4. A function used to read submissions
The page determines which page the current control belongs to based on a loop.
The Code is as follows:
<% @ Language = "VBScript %>
<HTML>
<Head>
</Head>
<Body>
<! -- Next button module programming starts -->
<Form action = "page03.asp" method = "Post">
<! ------------------------------------------------------------->
<! -- Start reading the function -->
<! ------------------------------------------------------------->
<%
Pageno = "_ p2"
For each item in request. Form
Whichpage = instr (1, CSTR (item), pageno, 1)
If (request. Form (item). Count) and (whichpage = 0) then
Strcount = request. Form (item). Count
Stritem = request. Form (item) (strcount)
Response. Write "<input type =" "hidden" "name =" & item & "" value = "& stritem &" ">" & vbcrlf
Elseif (not (request. Form (item). Count) and (whichpage = 0) then
Response. Write "<input type =" "hidden" "name =" & item & "" value = "& stritem &" ">" & vbcrlf
End if
Next
%>
<! ------------------------------------------------------------>
<1 -- end of reading function -->
<! ------------------------------------------------------------>
<! -- # Include file = "check_uncheck.txt" -->
<%
Function check_uncheck (ctrlname, ctrlvalue)
Dim ctrlname_in
Dim ctrlvalue_in
Dim ctrlvalue_actual
Dim outstr
Ctrlvalue_in = ""
Ctrlname_in = ""
Ctrlvalue_actual = ""
Outstr = ""
Ctrlname_in = ctrlname_in & ctrlname
Ctrlvalue_in = ctrlvalue_in & ctrlvalue
If request. Form (ctrlname_in). Count then
Strcount = request. Form (ctrlname_in). Count
Ctrlvalue_actual = request. Form (ctrlname_in) (strcount)
If ctrlvalue_actual = ctrlvalue_in then
Outstr = "checked"
End if
Else
Ctrlvalue_actual = request. Form (ctrlname_in)
If ctrlvalue_actual = ctrlvalue_in then
Outstr = "checked"
End if
End if
Check_uncheck = outstr
End Function
%>
<! -- Back button module start -->
<%
Stritem1 = ""
Stritem1a = ""
For each Item1 in request. Form
If request. Form (Item1). Count then
Strcount1 = request. Form (Item1). Count
Stritem1 = request. Form (Item1) (strcount1)
Response. Write "<input type =" "hidden" "name =" & Item1 & "" value = "& stritem1 &"> "& vbcrlf
Strcount1 = ""
Stritem1 = ""
Else
Stritem1a = request. Form (Item1)
Response. Write "<input type =" "hidden" "name =" & Item1 & "" value = "& stritem1a &"> "& vbcrlf
End if
Next
Stritem1 = ""
Stritem1a = ""
%>
From: http://goaler.xicp.net/Article/ShowArticle.asp? Id = 269