F.8.4- Sample List 04 - Multiple Selections, Looping the Result
by NT Community Manager.
|
| << F.8.3- Sample List 1 - Sample List Box | AppendixF | F.8.5- Sample List 06 - Parsing From Complex Choices >> |
Sample List 04 – Multiple Selections, Looping the Result
List03Form, List04Form and List05Form use identical forms but different code in response. In List04Response.asp we parse the values from the QueryString and write them individually:
...
<BODY>
<H3>List 04 Response</H3>
We will set your background
<%
If Request.QueryString("MusicTitle").Count=0 then
Response.Write " to be silent "
ElseIf Request.QueryString("MusicTitle").Count=1 Then
Response.Write " music to be "
Response.Write Request.QueryString("MusicTitle")
Else
Response.Write " music to rotate among <BR><BR>"
For iTitleCount=1 to Request.QueryString("MusicTitle").Count
Response.Write Request.QueryString("MusicTitle")(iTitleCOunt)
Response.Write "<BR>"
Next
End If
%>
<BR>as requested.
</BODY>
...
|
So the result is:
|
|
Sample List 05 – Multiple Selections, Looping With Correct Grammar
Again, we'll use the same form code as for the List03Form.htm page (except for the ACTION). This time, we'll be more careful with the grammar:
...
<BODY>
<H3>List 05 Response</H3>
We will set your background
<%
If Request.QueryString("MusicTitle").Count=0 Then
Response.Write " to be silent "
ElseIf Request.QueryString("MusicTitle").Count=1 Then
Response.Write " music to be "
Response.Write Request.QueryString("MusicTitle")
Else
Response.Write " music to rotate among "
For iTitleCount=1 To (Request.QueryString("MusicTitle").Count-2)
Response.Write Request.QueryString("MusicTitle")(iTitleCount)
Response.Write ", "
Next
Response.Write Request.QueryString("MusicTitle")_
(Request.QueryString("MusicTitle").Count-1)
Response.Write " and "
Response.Write Request.QueryString("MusicTitle")_
(Request.QueryString("MusicTitle").Count)
End If
%>
as requested.
</BODY>
...
So if we select Tannhauser, Lohengrin and Christus in the form, we get the message:
We will set your background music to rotate among Tannhauser, Lohengrin and Christus as requested.
| << F.8.3- Sample List 1 - Sample List Box | AppendixF | F.8.5- Sample List 06 - Parsing From Complex Choices >> |

RSS


