wisdomt
09-22-2005, 12:39 PM
I want to perform a "real-time" calculation on two prices contained within two drop-down list selection in some ASP/SQL code for our intranet site.
Basically, I have two drop-list price lists (A and B), with each price list being stored in a separate SQL database (ID, Description, Price).
When both price lists have a valid selection, I want to display the price B - A within the form.
I have got it working by refreshing the form using an "onchange" event, but this is messy and is causing problems elsewhere, I would love to get it working without having to keep refreshing the page, using JavaScript which is not my strongest skill, and not getting very far.
Any help very welcome.
The code for one of the drop-list lists is:
<select name="DesignerPriceList">
<option value=0></option>
<% sqlstr = "SELECT ID, Description, Price FROM TxDesignPriceList WHERE Designer=" & DesignerID & " ORDER BY Description"
rs2.Open sqlstr, conn
While Not rs2.EOF %>
<option value=<%=rs2("ID")%><%If int(DesignerPriceList) = rs2("ID") Then%> SELECTED <%End If%>><%=rs2("Description")%> / £<%=rs2("Price")%></option>
<% rs2.MoveNext
Wend
rs2.Close %>
</select>
Regards,
Steve
Basically, I have two drop-list price lists (A and B), with each price list being stored in a separate SQL database (ID, Description, Price).
When both price lists have a valid selection, I want to display the price B - A within the form.
I have got it working by refreshing the form using an "onchange" event, but this is messy and is causing problems elsewhere, I would love to get it working without having to keep refreshing the page, using JavaScript which is not my strongest skill, and not getting very far.
Any help very welcome.
The code for one of the drop-list lists is:
<select name="DesignerPriceList">
<option value=0></option>
<% sqlstr = "SELECT ID, Description, Price FROM TxDesignPriceList WHERE Designer=" & DesignerID & " ORDER BY Description"
rs2.Open sqlstr, conn
While Not rs2.EOF %>
<option value=<%=rs2("ID")%><%If int(DesignerPriceList) = rs2("ID") Then%> SELECTED <%End If%>><%=rs2("Description")%> / £<%=rs2("Price")%></option>
<% rs2.MoveNext
Wend
rs2.Close %>
</select>
Regards,
Steve