| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I am fairly new to ASP and have never used javascript with it ...
Here's my problem. I have a form with 2 drop down boxes among other stuff. The second dropdown box will populate depending upon the value selected in the first drop down. I need a way to submit the value selected in the first drop down; just as soon as it is selected or when the user moves to the next tab. It should not have a submit button. (Once a value in the second drop down is selected, and the user clicks update, the control passes to another page.) I tried using the onChange() for the <select> <% DIM dept %> That's the js code .. I'm pretty sure it's wrong <SCRIPT LANGUAGE = "JavaScript"> //To get the building from the dropdown and display the appropriate rooms function whichDepartment(department) { dept = department return department } </SCRIPT> <% That's the drop down. <select name="Dept" onChange="return whichDepartment(this)"> <% strSQL = "SELECT * FROM Department " &_ "ORDER BY DepartmentName " objRstAdd2.open strSQL, objConn WHILE NOT objRstAdd2.EOF %> <option value="<%=objRstAdd2("DepartmentID")%>"><%=Mid(objRstAdd2("DepartmentName"), 1, 10)%></option> <% objRstAdd2.MoveNext WEND objRstAdd2.Close %> </select> And thats the second drop down, which uses dept from the first drop down <select name = "room"> <% 'dept = request("Dept") strSQL = "SELECT Room FROM Room " &_ "WHERE Room.BuildingID IN (SELECT BuildingID FROM Building WHERE BuildingName = '"&authorizedBuilding&"') AND "&_ "Room.DepartmentID IN (SELECT DepartmentID FROM Department WHERE DepartmentName = '"& Dept &"') "&_ "ORDER BY Room " objRstAdd2.open strSQL, objConn WHILE NOT objRstAdd2.EOF %> <option value="<%=objRstAdd2("Room")%>"><%=(objRstAdd2("Room"))%></option> <% objRstAdd2.MoveNext WEND objRstAdd2.Close %> </select> Help! |
|
#2
|
||||
|
||||
|
Please post you questions in the correct area of the forum. The code bank is for sample code only.
|
|
#3
|
|||
|
|||
|
Quote:
My apologies. Won't happen again. |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > drop down without submit button |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|