Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2006
    Posts
    44

    Unanswered: Pop-up window with selected value

    Hi, i have a dropdown list.
    Once i selected a value, it will automatically pop up a new window, displaying the values. The values will get from the db using the selected dropdown list value..
    However, i cant get the value for my dropdown list..
    How shld i get it?


    Javascript code to pop up new window
    Code:
    	function open_win() {
    		window.open("openEditLink.asp")
    			}
    Code to display the dropdown list and get the value
    Code:
    <tr><td>Vulnerability Link: </td> 
    <td><select name=vulLink id=select onchange ="open_win()">
    		<option value="none">--Select Link--
    		<%While (NOT rs_vulLink.EOF)%>	
    			<option value="<%=(rs_vulLink.Fields.Item("vul_no").Value)%>"<%If (Not isNull((Session("vulLink")))) Then If (CStr(rs_vulLink.Fields.Item("vul_no").Value) = CStr((Session("vulLink")))) Then Response.Write("SELECTED")%>><%=(rs_vulLink.Fields.Item("vul_no").Value)%></option>
    		<%
    			rs_vulLink.MoveNext()
    			Wend
    
    			If (rs_vulLink.CursorType > 0) Then
    			rs_vulLink.MoveFirst
    
    			Else
    			rs_vulLink.Requery
    			End If
    		%>
    </select></td></tr>

    Codes to display the values (pop up window)
    Code:
    Dim rs_viewRec
    
    Set rs_viewRec = Server.CreateObject("ADODB.Recordset")
    rs_viewRec.ActiveConnection = MM_dsprms_STRING
    rs_viewRec.Source = "SELECT * FROM Security_Vulnerability WHERE Vul_No= '" & request.form("vulLink") & "'"
    rs_viewRec.CursorType = 0
    rs_viewRec.CursorLocation = 2
    rs_viewRec.LockType = 1
    rs_viewRec.Open()
    
    response.write rs_viewRec.source
    Thanx

  2. #2
    Join Date
    Feb 2006
    Location
    Seattle / Eastside
    Posts
    10

    Code to display the dropdown list and get the value
    Code:
    <tr><td>Vulnerability Link: </td> 
    <td><select name=vulLink id=select onchange ="open_win()">
    		<option value="none">--Select Link--
    		<%While (NOT rs_vulLink.EOF)%>	
    			<option value="<%=(rs_vulLink.Fields.Item("vul_no").Value)%>"<%If (Not isNull((Session("vulLink")))) Then If (CStr(rs_vulLink.Fields.Item("vul_no").Value) = CStr((Session("vulLink")))) Then Response.Write("SELECTED")%>><%=(rs_vulLink.Fields.Item("vul_no").Value)%></option>
    		<%
    			rs_vulLink.MoveNext()
    			Wend
    
    			If (rs_vulLink.CursorType > 0) Then
    			rs_vulLink.MoveFirst
    
    			Else
    			rs_vulLink.Requery
    			End If
    		%>
    </select></td></tr>
    Normally I debug something like this by looking at the output code (view source on html page)...that should help. Could it be that you didn't close your first option tag (after --Select Link--)? I've colored it above for quick reference.

    I'd dig into this more as I really like this kind of stuff, but I must run for now -I'll check back later -

    Best of luck!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •