VBAPrincess
Programmer
I have some code that is populating a combo box with locations and it is supposed to add "selected" to the option that was passed in the query string. However, the "selected" portion is not working.
<%
Dim rsLook
Set rsLook = Server.CreateObject("ADODB.Recordset")
sSQL = "SELECT Events.EventID, Events.EventName, Events.StartDate, Events.Status FROM Events " & _
"WHERE (((Events.StartDate)>=Date()) AND ((Events.Status)='open')) ORDER BY Events.StartDate;"
rsLook.open sSQL, oConn
response.Write("<select name='EventID'>")
Do Until rsLook.EOF
if rsLook("EventID")=Request.QueryString("EventID") then
response.write("<option value='" & rsLook("EventID") & "' selected>")
else
response.Write("<option value='" & rsLook("EventID") & "'>")
end if
response.write(rsLook("StartDate") & " -- " & rsLook("EventName") & "</option>" &vbcrlf)
rsLook.MoveNext
Loop
rsLook.close
%>
</select>
Here's a link to the calendar page. When you click on the "click here to RSVP" for any of the events, the RSVP form comes up and the Event combo box should have the event you wish to RSVP for already selected in the combo. Here's what I know:
--> The event ID is appearing in the URL (ex: rsvp.asp?eventid=3)
--> I have a hidden field in my form that also has
value="<%= Request.QueryString("EventID") %>"
and when I view source, the value is correct.
I've been banging my head for too long now. I need fresh eyes to take a look and tell me what's wrong. I have this same code (with one exception: I'm not getting a QueryString value) on a page in the admin section and it works just fine.
Thanks in advance!
Diana
VBA Princess
-- I'm hoping to grow up to be a Goddess!
<%
Dim rsLook
Set rsLook = Server.CreateObject("ADODB.Recordset")
sSQL = "SELECT Events.EventID, Events.EventName, Events.StartDate, Events.Status FROM Events " & _
"WHERE (((Events.StartDate)>=Date()) AND ((Events.Status)='open')) ORDER BY Events.StartDate;"
rsLook.open sSQL, oConn
response.Write("<select name='EventID'>")
Do Until rsLook.EOF
if rsLook("EventID")=Request.QueryString("EventID") then
response.write("<option value='" & rsLook("EventID") & "' selected>")
else
response.Write("<option value='" & rsLook("EventID") & "'>")
end if
response.write(rsLook("StartDate") & " -- " & rsLook("EventName") & "</option>" &vbcrlf)
rsLook.MoveNext
Loop
rsLook.close
%>
</select>
Here's a link to the calendar page. When you click on the "click here to RSVP" for any of the events, the RSVP form comes up and the Event combo box should have the event you wish to RSVP for already selected in the combo. Here's what I know:
--> The event ID is appearing in the URL (ex: rsvp.asp?eventid=3)
--> I have a hidden field in my form that also has
value="<%= Request.QueryString("EventID") %>"
and when I view source, the value is correct.
I've been banging my head for too long now. I need fresh eyes to take a look and tell me what's wrong. I have this same code (with one exception: I'm not getting a QueryString value) on a page in the admin section and it works just fine.
Thanks in advance!
Diana
VBA Princess
-- I'm hoping to grow up to be a Goddess!