Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 Combo/Select Boxes

Status
Not open for further replies.

jiggyg

Programmer
Oct 1, 2007
61
0
0
US
Hi!

I'm wondering how to get two combo boxes to work in conjunction w/ each other....

I have one combo box (filterVal) that IS working correctly; this array has both an id[0] and name[1]:

Code:
Response.Write "<td>"

Response.Write "<select size=""1"" name=""filterVal"" onChange=""filterPage(this)"">"
  Response.Write"<option value=0>Show All Count Types</option>"
  Response.Write"<option value=-1 "
     if request("filterVal") = "-1" then response.write "selected" end if
    response.write ">Show All Unassigned</option>"
      for x = 0 to ubound(countType, 2)
        Response.Write"<option value =" & countType(0,x)
        if cstr(countType(0,x)) = request("filterVal") then
          Response.Write " selected"
        end if
        Response.Write ">" & countType(1,x)  & "</option>"
           Next
Response.Write "</select>"

Response.Write "</td>"

And a SECOND one that IS NOT working; this one only has a name[0]:

Code:
Response.Write "<td>"

Response.Write "<select size=""1"" name=""blockFilterVal"" onChange=""filterPage(this)"">"
  Response.Write"<option value=0>Show All Blocks</option>"
     for x = 0 to ubound(blocks, 2)
    Response.Write"<option value =" & blocks(0,x)
       if cstr(blocks(0,x)) = request("blockFilterVal") then
         Response.Write " selected"
       end if
    Response.Write ">" & blocks(0,x) & "</option>"
     Next
Response.Write "</select>"

Response.Write "</td>"

SQL to populate 'blocks' array:
Code:
sql3 = "select distinct Block from AreaEval "
sql3 = sql3 & "ORDER BY Block"
set rs = server.CreateObject("ADODB.Recordset")
rs.Open sql3, Application("DataConn")
if not rs.EOF and not rs.BOF then			
	blocks = rs.GetRows()
end if
rs.Close

And my JS:
Code:
function filterPage(itm){
  document.forms[0].action="assignCountTypes.asp";
  document.forms[0].submit();
}

So, I guess I need to know:
1. What's wrong w/ my second select box that it isn't working
and
2. Once the second select box is working, how to get the two of them to work in conjunction (or maybe, once I get the second on working, it automatically will??)


Thanks much!
-jiggyg
 
I'm not sure what you mean by "IS NOT working".
Do you see an error message?
If not what does it do?


Oftentimes when I have problems using ASP to dynamically create client-side code, I find the problem by using the "View Source" command in the browser. Sometimes it helps to take the ASP out of the equation and just work with a static HTML page until I get the client-side JavaScript worked out... then it become a much simpler matter to build an ASP that generates the proper JavaScript.


Anyway, the FAQs for this forum have 4 posts listed under the heading "Dynamic List Boxes" so maybe one of them will help. See here: scroll down for the listbox section.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top