Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drop-Down Box - where does one call the cookie?

Status
Not open for further replies.

KingElvis

Programmer
Jan 28, 2004
39
0
0
IL
Where in the code for a Drop-Down Box, does one place the ASP code for a cookie?

When I place it as shown below, I get an error message.


<select size="1" name="sDuration">
<option selected>Duration</option>
<option>05 min</option>
<option>10 min</option>
<option>15 min</option>
<option>45 min</option>
<option>1 hr</option>
<%=Request.Cookies(consts_CollectionName_Shiur)("sduration")%> </select>
 
When the user submits the page, a validation routine is run. If there is an error, the page refreshes WITH all the previously entered data.

Thus, if he selected "10 mins", but the validation routine finds an error on some other entered data, then the refresh screen should still show "10 mins
 
you'll need to do that with an array then because then values aren't sequential Obviously adapt the valuse to suit

Code:
dim i
dim CurrDuration
CurrDuration = Request.Cookies(consts_CollectionName_Shiur)("sduration")
dim DurArray(4)
DurArray(0) = 5
DurArray(1) = 10
DurArray(2) = 15
DurArray(3) = 45
DurArray(4) = 60
with response
    .write "<select name='sDuration'>"
for i = 0 to ubound(DurArray)
   .write "<option value='"
   .write DurArray(i)
   .write "'"
if cint(CurrDuration) = DurArray(i) then
   .write "selected"
end if
   .write ">"
   .write DurArray(i)
   .write " mins"
   .write "</option>" & vbCrLf
next
   .write "</select>"
end with


Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems

So long, and thanks for all the fish.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top