Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Help!. Problem retaining select option value after submit


Message #1 by Joe Lee <bugmania76@y...> on Fri, 30 Aug 2002 04:58:40 -0700 (PDT)
Hi guys, i've been trying to use Onclick function to perform multiple submit on a form so that i can populate all my three drop
dependent tables.
Right now i just cannot get the selected value to retain its previous value after the second dropdown box is selected. This is my
codes, hopefully i can get a fast reply as my assignment is going to be due soon. Thank In Advance.!!

I've use Request function to capture the year and month value 
after each submit and after the second selection is made. 
The value on the first dropdown list will change to its default.
E.G when i choose 2002 in box 1, the screen will refresh and box 2 
result will populate based on box 1 selection. When box 2 selection is made, box 3 selection will populate itself based on selction
on box 1 and 2. The problem is box 1 SELECTED value will change to the default, which does not show 2002 anymore.

Dropdown box 1:

<select name="year" onChange="subFrm()">
<option value="">Please Select Year</option>
<% do until rs.EOF %>
<% If yearfield = "" Then %>
<OPTION value='<%=rs("year")%>'><%=rs("year")%></OPTION>
<% Else %>
<OPTION selected value='<%=rs("year")%>'><%=rs("year")%></OPTION>
<% End If %>
<% rs.movenext 
   loop %>


Dropdown Box 2:
<select name="month" onChange="subFrm()">
<OPTION  value="<%=Request("month")%>"><%=Request("month")%></OPTION>
<% do until rs.EOF %>
<% If monthfield <> "" Then %>
<OPTION value=<%=rs("month")%>><%=rs("month")%></OPTION>
<% Else %>
<OPTION value='<%=rs("month")%>'><%=rs("month")%></OPTION>
<% End If %>
<% rs.movenext 
   loop %>
</select> 


Dropdown Box 2:
<select name="surveyCode">
<% do until rs.EOF %>
<OPTION selected value='<%=rs("survey_code")%>'><%=rs("code_description")%></OPTION>
<% rs.movenext 
   loop %>
</select> 


Regards,
Joe



---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes

  Return to Index