View Single Post
  #4 (permalink)  
Old April 29th, 2008, 06:05 PM
mat41 mat41 is offline
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41

Its not a bad thing re-submitting the page to achieve your objective. However why use multiple forms??? there is no need.
I would:

> get rid of multiple forms, use only one.
> when you call your onChange function submit the form!!
> you should check if your record set is empty when you create your select lists, this is just good code practice.

Anyhow here is how I would code up your first select list includig the code to ensure the previous selection remains selected:
NOTE - The below method will only work for you if each time you call the onChange function the form is submitted

 strSQL = "SELECT distinct class from s6test;"
 objRS.Open strSQL, objconn
   if not objRS.eof then %>
      <select name="xclass" onchange="reload(this.form)">
       <option value="">Class</option>
<% Do While Not objRS.EOF %>
         <option value="<%= objRs("class") %>" <% if trim(request.form("xclass")) <> "" then
                                                     if trim(request.form("xclass")) = objRs("class") then
                                                        response.write " selected "
                                                     end if
                                                  end if %>><%= objRs("class") %></option>
<% objRS.MoveNext
      objRs.Close %>
<% else %>
      <i>No records found</i>
<% end if %>

Wind is your friend
Reply With Quote