JavaScript for calculation from two database generated drop-down lists.


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 1 of 1

Thread: JavaScript for calculation from two database generated drop-down lists.

  1. #1
    Join Date
    Sep 2005
    Posts
    2

    JavaScript for calculation from two database generated drop-down lists.

    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 ideas 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
    Last edited by wisdomt; 09-19-2005 at 07:25 AM.

Similar Threads

  1. Database not properly created
    By Arjuna in forum Database
    Replies: 2
    Last Post: 07-25-2007, 03:22 AM
  2. Replies: 2
    Last Post: 03-15-2002, 02:08 PM
  3. Adobe Acrobat PDF files generated by database
    By Paul Dionne in forum ASP.NET
    Replies: 1
    Last Post: 08-08-2000, 06:20 AM
  4. open a javascript database connection
    By Toby in forum ASP.NET
    Replies: 0
    Last Post: 07-25-2000, 08:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center