Hi,
I had tried to simplify my problem for the ease of explanation but I’ll
try to explain it now:
I have a site in which users can add an update to a list of events in
their area. When the user wishes to update an event they select an event
from a list and are taken to an ‘update page’ populated by a recordset
named rsChosenEvent. One of the fields in rsChosenEvents is themes. So
on the update page I have a list box populated by rsThemes which has
values set as rsThemes.ThemeID.value and the label as
rsThemes.ThemeName.value. So initially the theme is selected by:
<% If Not rsChosenEvent.EOF Or Not rsChosenEvent.BOF Then %><% If
(RsThemes.Fields.Item("ThemeID").Value) =
(RsChosenEvent.Fields.Item("Theme").Value) Then
Response.write("SELECTED ") %><% End IF %>
This is all fine and all works. What complicates matters is that I need
a button next to the themes listbox which takes users to a ‘theme adding
page’ in which they can add new themes. When they browse back to the
update page again I need all of the values that they had already updates
to be intact. So what I have done is added a group of hidden fields to
the theme adding page which carry the fields values back to the update
page again. At this point the rsChosenEvents is empty and the update
page is now populate dby the values passed from the hidden fields. So
now I need to slect a theme by something along the lines of:
<% if Request(“txtTheme”) = (RsThemes.Fields.Item("ThemeID").Value) then
response.write(“ SELECTED “) %> but if I put this inside the option tags
it never works.
This is the code I have at the moment which I’ve tried playing with:
<select name="txtTheme" id="txtTheme" style="width:120px;">
<option>Select Theme</option>
<%
Dim PassedTheme
Dim PickThis
PassedTheme = Request("txtTheme") %>
<% While (NOT RsThemes.EOF)%>
<% If Not rsChosenEvent.EOF Or Not rsChosenEvent.BOF Then %><% If
PassedTheme = (RsChosenEvent.Fields.Item("Theme").Value) Then Pickthis =
" SELECTED " %><% End IF %>
<option <% If Not rsChosenEvent.EOF Or Not rsChosenEvent.BOF Then %><%
If (RsThemes.Fields.Item("ThemeID").Value) =
(RsChosenEvent.Fields.Item("Theme").Value) Then
Response.write("SELECTED ") %><% End IF %><%= PickThis %><%IF
(RsThemes.Fields.Item("ThemeID").Value) = PassedTheme Then Choosethis =
" SELECTED " End IF %> <%= ChooseThis %>
value="<%=(RsThemes.Fields.Item("ThemeID").Value)% >"><%=(RsThemes.Fields
..Item("ThemeName").Value)%></option>
<%
RsThemes.MoveNext()
Wend
If (RsThemes.CursorType > 0) Then
RsThemes.MoveFirst
Else
RsThemes.Requery
End If
%>
</select>
I hope my explanation is clear enough. Do you have any idea why this
doesn’t work?
Thanks, Luke
*** Sent via Devdex
http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!