Forum Moderators: phranque
This is the code I have from Dreamweaver so far which populates the list box with a list of materials from the database. (It is an Access database).
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/lrm.asp" -->
<%
set materials = Server.CreateObject("ADODB.Recordset")
materials.ActiveConnection = MM_lrm_STRING
materials.Source = "SELECT * FROM Materials"
materials.CursorType = 0
materials.CursorLocation = 2
materials.LockType = 3
materials.Open()
materials_numRows = 0
%>
<snip...>
<select name="select">
<%
While (NOT materials.EOF)
%>
<option value="<%=(materials.Fields.Item("Cost").Value)%>" ><%=(materials.Fields.Item("Materials").Value)%></option>
<%
materials.MoveNext()
Wend
If (materials.CursorType > 0) Then
materials.MoveFirst
Else
materials.Requery
End If
%>
</select>
<snip...>
<%
materials.Close()
%>
Any help is very much appreciated/
Tracy
edit reason: please don't post so much code that is not related to the issue. Thanks![\1] [1][edited by: txbakers at 1:11 pm (utc) on Nov. 5, 2002]
Am I correct in saying that you would like to populate a text box with the price of the item selected in the drop down list?
If use the DOM to change the value attribute of the text box. You would then use the onChange method in the <option> field.
That is, you would dynamically write your <option> using ASP and then onChange="textbox.value='{Price retrieved from database}';".
Hope this helps!
<added> You would also need to add more ASP to retrieve the item price from the database too. </added>