Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    May 2005
    Mount Shasta, CA
    Thanked 0 Times in 0 Posts

    Question price calculator w/ two dropdown menus

    The pricing calculator I am building into this form is dependent upon two menu choices. Using the following function I had it working beautifully for one dropdown (#price# is ColdFusion's way of saying, this product's value):

    function reCalc() {
    si = document.eForm.qty.selectedIndex;
    v = si*#price#+#price#;
    document.getElementById('subT').innerHTML = v;
    Using this menu (<cfloop> is ColdFusion's way of saying print 20 <option> statements.):

    <select name="qty" onchange="reCalc()">
    <cfloop index="i" from="1" to="20" step="1">
    <option> #i#</cfloop>
    But I need to add a second menu to this mix (here <cfoutput> is how ColdFusion loops through a query result set to display, in this case, product titles with associated prices):

    <select name="type" onchange="reCalc()">
    <cfoutput query="addon" group="title">
    <option value="#price#"> #title#</cfoutput>
    The value of "subT" needs to be adjusted each time either menu value is changed. My attempt to alter the function like so...

    function reCalc() {
    si = document.eForm.qty.selectedIndex;
    ti = document.eForm.type.selectedIndex;
    v = si*ti+ti;
    document.getElementById('subT').innerHTML = v;
    ...did not work. What am I doing wrong?

    Frustrated and grateful,
    Last edited by GoldDog; 05-21-2005 at 06:42 PM.


Posting Permissions

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