473,666 Members | 2,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with dropdown lists: one disappears after the previous one is selected

8 New Member
I really hope this makes sense to someone because I really need some assistance with this:

I have a asp page that I am working on that has as many as 4 dropdownlists depending on what I choose in those dropdowns. The 4 dropdowns are named:iSource, iSub1, iSub2, iSub3. To begin I select an item for iSource then iSub1 comes up and I have an option to choose ALL or any of the other items in the recordset. If I choose ALL it will bring up iSub2 which populates everything that I would have chosen for each of the items in iSub1. After selecting ALL and iSub2 dropdown comes up I choose an item from iSub2. This is where the problem happens. Once I select something from iSub2 dropdown it disappears and iSub1 comes back up. What I want it to do once I select something from iSub2 it should show iSub3 dropdown. Based on my code what am I doing incorrectly. I am showing two pieces of code from the page. The first is the html table with each of the dropdowns and the second is the sql recordset statements:

Expand|Select|Wrap|Line Numbers
  1. <table width="100%" cellpadding="2" cellspacing="0" border="0">
  2.         <tr>
  3.                 <td>
  4.                 Select a Source:
  5.                 <select name="cboSource" id="cboSource" onchange="cboSourceChange()">
  6.             <option value="0"></option>
  7.         <%    While Not rsSource.EOF%>
  8.         <option value="<%=rsSource("iParameterId")%>"
  9.  <%if cLng(rsSource("iParameterId")) = cLng(iSource) then response.Write " Selected " %>>
  10.     <%=rsSource("vchParameterDesc")%>
  11.             </option>
  12.             <%    rsSource.MoveNext
  13.             wend
  14.                 %>
  15.         </select>
  16.         &nbsp;(<%=iSource%>)
  17.     </td>
  18.     </tr>
  19.     <tr>
  20.     <td>
  21.             <%    if iSource <> "0" then %>
  22.                 Select a Source Sub 1:
  23.             <%        if not rsSub1.EOF then %>
  24.             <select name="cboSub1" id="cboSub1" onchange="cboSub1Change()">
  25.             <option value="0"></option>
  26.                 <option value="1">ALL</option>
  27.             <%    While Not rsSub1.EOF%>
  28.                 <option value="<%=rsSub1("iParameterId")%>" 
  29. <%if cLng(rsSub1("iParameterId")) = cLng(iSub1) then response.Write " Selected " %>>
  30.     <%=rsSub1("vchParameterDesc")%>
  31.         </option>
  32.             <%
  33.     rsSub1.MoveNext
  34.         wend
  35.                 %>
  36.         </select>
  37.         &nbsp;(<%=iSub1%>)
  38.     <%        else 
  39.     response.Write "No Source Sub 1 options defined." 
  40.         end if %>
  41.         </td>
  42.             </tr>
  43.                 <tr>
  44.             <td>
  45.         <%        if iSub1 <> "0" then %>
  46.         Select a Source Sub 2:
  47.         <%            if not rsSub2.EOF then %>
  48.                 <select name="cboSub2" id="cboSub2" onchange="cboSub2Change()">
  49.                     <option value="0"></option>
  50.     <%                While Not rsSub2.EOF%>
  51.         <option value="<%=rsSub2("iParameterId")%>" 
  52. <%if cLng(rsSub2("iParameterId")) = cLng(iSub2) then response.Write " Selected " %>>
  53.     <%=rsSub2("vchParameterDesc")%>
  54.         </option>
  55.             <%rsSub2.MoveNext
  56.             wend
  57.                         %>
  58.         </select>
  59.         nbsp;(<%=iSub2%>)
  60.             <%    else 
  61.         response.Write "No Source Sub 2 options defined." 
  62.             end if %>
  63.             </td>
  64.                 </tr>
  65.                 <tr>
  66.             <td>
  67.         <%            if iSub2 <> "0" then %>
  68.             Select a Source Sub 3:
  69.         <%                if not rsSub3.EOF then %>
  70.         <select name="cboSub3" id="cboSub3" onchange="cboSub3Change()">
  71.                 <option value="0"></option>
  72.             <%                    While Not rsSub3.EOF%>
  73.         <option value="<%=rsSub3("iParameterId")%>"
  74. <%if cLng(rsSub3("iParameterId")) = cLng(iSub3) then response.Write " Selected " %>>
  75. <%=rsSub3("vchParameterDesc")%>
  76.         </option>
  77.     <%
  78.     rsSub3.MoveNext
  79.     wend
  80.         %>
  81.         </select>
  82.     &nbsp;(<%=iSub3%>)
  83.     <%        else 
  84.         response.Write "No Source Sub 3 options defined." 
  85.     end if %>
  86.     <%            end if 
  87.     end if 
  88. end if %>
  89.             </td>
  90.         </tr>
  91.         </table>
Expand|Select|Wrap|Line Numbers
  1. ' Get a recordset of the primary sources for an Onyx Sales Opportunity
  2. sql = "Select iParameterId, vchParameterDesc from ReferenceDefinition " & _
  3.         "where iReferenceId = 11 and tiRecordStatus = 1 and iParentId = 3 order by vchParameterDesc"
  4.  
  5. Set rsSource = Server.CreateObject("ADODB.Recordset")
  6. rsSource.Open sql, cnOnyx, 0, 1
  7. ' If a source was selected, get a list of the sub source 1 options.
  8. If iSource <> "0" then    
  9.     sql = "Select iParameterId, vchParameterDesc from ReferenceDefinition " & _
  10.             "where iReferenceId = 641 and tiRecordStatus = 1 and iParentId = " & iSource & _
  11.             "  order by vchParameterDesc"
  12.     Set rsSub1 = Server.CreateObject("ADODB.Recordset")
  13.     rsSub1.Open sql, cnOnyx, 0, 1    
  14.         ' If a sub source 1 is selected, get a list of sub source 2 options.
  15.  
  16.     'M006A Begin
  17.     If iSub1 <> "0" then
  18.  If iSub1 = "1" then
  19.   sql = "Select iParameterId, vchParameterDesc from ReferenceDefinition " & _
  20.                 "where iReferenceId = 642 and tiRecordStatus = 1" & _
  21.                 " order by vchParameterDesc"
  22.  else
  23.          sql = "Select iParameterId, vchParameterDesc from ReferenceDefinition " & _
  24.                 "where iReferenceId = 642 and tiRecordStatus = 1 and iParentId = " & iSub1 & _
  25.                 " order by vchParameterDesc"
  26.  
  27.  end if
  28.  
  29.         Set rsSub2 = Server.CreateObject("ADODB.Recordset")
  30.         rsSub2.Open sql, cnOnyx, 0, 1
  31.                   Set rsSub2 = Server.CreateObject("ADODB.Recordset")
  32.        rsSub2.Open sql, cnOnyx, 0, 1  
  33.  
  34. if not rsSub2.eof then
  35. rsSub2.MoveFirst
  36.  
  37. end if
  38.  
  39.   'end if
  40.   'M006A End
  41.         ' If a sub source 2 is selected, get a list of sub source 3 options.
  42.         If iSub2 <> "0" then
  43.  
  44.             sql = "Select iParameterId, vchParameterDesc from ReferenceDefinition " & _
  45.                     "where iReferenceId = 643 and tiRecordStatus" & _
  46.                     "order by vchParameterDesc"
  47.  
  48.             Set rsSub3 = Server.CreateObject("ADODB.Recordset")
  49.             rsSub3.Open sql, cnOnyx, 0, 1
  50.  
  51.         End If   
  52.         'response.Write(sql)
  53.                   '  response.End()
  54.     End If   
  55.  
  56. End If 
May 28 '10 #1
1 1436
jhardman
3,406 Recognized Expert Specialist
This isn't really an asp question, it all depends on the javascript functions (cboSub1Change etc) that open the selects. I bet if you look carefully you aren't tracking the names of the controls carefully.

Anyway, if you need more help, I would post in the javascript forum.

Jared
May 29 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2026
by: Marc | last post by:
I've gotten everything up and running except for this -- I'd like to be able to have people have a dropdown list of cities in the US to use (or wherever) and not have to input them manually into a text field. When you do then there are issues of misspellings, etc. Now I have a list of cities from each state that is a sample that works in an html page. Problem is that it takes up 2 MB! Way too much to load on a single page and I was...
2
495
by: Tony Grider | last post by:
I am trying to find a way to create dependent dropdown lists in C# The old way I knew involved javascript and will no longer work in the new design. I need for each list to be database driven (data is pulled from database) Example: First Box would have Years 2004, 2003, 2002, 2001, etc. Second Box: would have Ford, Chevy, Dodge, Toyota, Honda, etc Third Box would have items based from first selelction(if Ford chosen) F-150, Explorer,...
0
2067
by: Mike O. | last post by:
MS Access 2003 "filter by form" has drop down lists that allow the user to select values for each field to filter by. However, once some values are selected,the remaining dropdown lists remain the same and aren't progressively filtered to reflect the selections already made in other fields. This can be very tedious when filtering a large datasheet. Unlike Access, the MS Excel autofilter has automatic progressive filtering of value...
0
1782
by: Henke | last post by:
Hi, I have done some research about my problem I have when using the "back button" in IE to go back to a page with two dropdown lists. The both dropdown lists are populated with data. The first dropdown lists is redirecting the user to another page (building a querystring for the second page to use) and when the back button
2
3620
by: Chris Becker | last post by:
This is my attempt to rephrase a question I asked earlier that got no response. I suspect it was my poor/unplanned wording. Here is another attempt: I have a form with some drop down lists. I would like the user to be able to start filling in the form, then get to one of the dropdown lists (ex: Service Type) and realize that the dropdown list does not contain the entry that they need. So next to the Service Type drop down list is a...
0
1124
by: Anthony | last post by:
So I've got three dropdowns in a datagrid footer (to add records). I need them to cascade, in the first one I have three choices, in the second one I have anywhere from 3 to 10 choices, depending on what is selected in the first one, etc, etc. Whats happening is that when the auto-postback occurs, it fires the event for the dropdownlist change, which calls the Getxxx routines that update the dropdownlist's datasource to the new datatable...
1
1557
by: Ed Chiu | last post by:
Hi, I have 2 dropdown lists on an ASP.Net page, the first is a list of states of US, the second is City list. When user selects a state, the web page does a postback, create a DB connection and bind a dataset to city dropdown list. This is working for me. But I would like to do this on the client side for the following reasons: (1) Doing this on server side takes time, the postback and connecting to DB costs too much.
1
2053
by: cgian31 | last post by:
I have implemented a website where in a page are represented the data of one record, using cascade dropdown lists in 2 levels, within the same page/record. According to the selection in the first dropdown (parent), the available choices in the second one (child) change. It works pretty well, except for the fact that when I retrieve an existing record the second dropdown list is not correctly updated to display the entry selected at the...
2
1764
by: Lair | last post by:
I am creating a page that has three to four databound dropdown lists. Each one is has different data sometimes from the same table but with a different where clause. What is the best way to populate the data onload? Right now it's opening and closing a connection for each dropdown list/Query. I would like to find a way that I can do all the queries at once without having to open and close the connection several times. I am using mysql/...
1
1270
by: eddie23 | last post by:
Hi group. we've an ASP.net application. there are dropdown lists all over it. we use IE6 SP2 here in work. When the dropdown is accessed by someone logged in as a local admin to the XP workstation the dropdown appears as a long list (which is great in that you don't need to scroll). BUT when a regular user is logged in, IE behanves differently in that it displays a smaller window to show the list's contents and has a vertical scrollbar for...
0
8443
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8866
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8550
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6192
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4366
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2769
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1772
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.