How the Setup Wizard uses ASP to produce the home page of the Setup Wizard
What are the main problems facing them:
1. The interface is exactly the same as a Windows wizard, with the Next and Back buttons
2. Users can use the Back button to return to any previous step and can change what has been selected in any previous step
3. Form must remember all the content that is filled in
4. Unable to use database
5. Cannot use sessions to prevent all input loss of the user if Sessiosn fails, and unfortunately, it is not possible to use cookies
Because many support cookies that often turn off the browser.
6. Portability is better because it adapts to the same number of installation steps
Solution:
1. Passing parameters using hidden variables
2. Using post, do not use Get method, because this way is limited by the length
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 forward one page
If you use checkboxes on your page or use radio buttons, read the values using the following code:
<% 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 treatment methods are used for checkboxes and radio:
1. Only the most recent values are considered to be saved using both methods
2. Users can use the back to change the values entered previously, but they must be submitted using next before they can take effect
3. Page must be able to cope with multiple controls situations on a page
Specific implementation methods:
The nth page should have:
1. First form: its action= page (n+1). asp and it must have the Next button at the bottom
2. Second form: its action= page (N-1). asp and Back button
3. Variable naming conventions: N_<page no> suffix is a control type. <input type = RADIO NAME = radio_p2>
is a name on the second page that is radio.
4. A function to read the commit
The page is based on a loop to determine which page the current control belongs to.
The code is as follows:
<% @LANGUAGE = "VBSCRIPT%>
<HTML>
<HEAD>
</HEAD>
<BODY>
<!--Next button module programming begins-->
<form action= "page03.asp" method= "POST" >
<!------------------------------------------------------------->
<!--read function started-->
<!------------------------------------------------------------->
<%
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 (Request.Form (Item). Count) and (whichpage = 0)) Then
Response.Write "<input type=" "HIDDEN" "Name=" "" & Item & "" "Value=" "& Stritem &" ">" &vbcrlf
End If
Next
%>
<!------------------------------------------------------------>
<1--read into function end-->
<!------------------------------------------------------------>
<!--#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 starts-->
<%
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 &" ">" &vbcr Lf
StrCount1 = ""
StrItem1 = ""
Else
STRITEM1A = Request.Form (Item1)
Response.Write "<input type=" "HIDDEN" "Name=" "" & item1& "" "Value=" "& Stritem1a &" ">" &vbcr Lf
End If
Next
StrItem1 = ""
STRITEM1A = ""
%>