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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to return selected field from SELECT?

Status
Not open for further replies.

dannyd

IS-IT--Management
Apr 30, 2002
8
CA
I have a select in an ASP page that is being populated by a database table. I am trying to open a new browser window with the html page associated to the record in my DB. I have attached a copy of my code below. I want to get the info from a certain field in the currently selected record to be the XXXX.html page I am trying to open with the submit button.

<html>
<HEAD>
<%'To check the browser capabilities this goes above everything
function checkbrowser
Set check = server.createObject(&quot;MSWC.BrowserType&quot;)
if check.browser=&quot;IE&quot; and check.version >= &quot;4.0&quot; Then
checkbrowser = &quot;DropStyle&quot;
Else
checkbrowser = &quot;&quot;
End if
End function
'this goes in the head. very basic CSS
%>
</HEAD>

<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
Sub ShowProduct_onClick
window.open &quot;/documents/products/images/XXXX.html&quot;
End Sub
</SCRIPT>

<%
Set DBObj = Server.CreateObject(&quot;ADODB.Connection&quot;)
DBObj.Open &quot;Imalog-DB&quot;
SQLQuery = &quot;SELECT proProduct, proName, proDescription FROM Products&quot;
Set RSProducts = DBObj.Execute(SQLQuery)
%>

<CENTER>
<FONT FACE=&quot;Comic Sans MS&quot;>
<H1>List of Proucts</H1>

<form>
<select name=&quot;proName&quot; size=&quot;1&quot;>
<OPTION value=&quot;&quot;>Please Select a Product</OPTION>
<OPTION value=&quot;&quot;>-----------------------</OPTION>
<% Do While Not RSProducts.EOF %>
<option><%=RSPRoducts(&quot;proName&quot;)%></option>
<%
RSProducts.MoveNext
Loop
DBObj.Close
%>
<input type=button value=&quot;Submit&quot; name=&quot;ShowProduct&quot; tabindex=&quot;1&quot;>
</form>

</html>

 
Thanks for the info Fester, but I still can't get it. What am I doing wrong in my ShowProduct Sub? Can't get the value to return?????

Thanks!!!
 
something like this perhaps?? uses javascript instead tho

Code:
....
<SCRIPT LANGUAGE=&quot;JAVASCRIPT&quot;>
function ShowProduct_onClick()
{
  var mypage = document.testForm.proName.value;
  window.open('[URL unfurl="true"]http://www.myserver.com/mypath/'+[/URL] mypage + '.htm,'newWindow');
}
</SCRIPT>
</HEAD>

<BODY>
<FORM NAME=testForm onSubmit=&quot;ShowProduct_onClick();&quot;>
....rest of form code here
Tony
 
Works super....thanks!!!!

Thanks a lot for all the help!!!!

Really appreciated!!!

Danny
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top