Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3433776
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:37:03+00:00 2026-05-18T07:37:03+00:00

Calculating form has options and based on what the client enters determines what products

  • 0

Calculating form has options and based on what the client enters determines what products load in a sidebar. Products are given a quantity that directly reflects that value of the option.

So now per product there is a Total Price, Total Duration and Total Number of Dives as seen here.

num1=Number(document.getElementById('product_quantity_' + productid).value);
num2=Number(document.getElementById('product_price_' + productid).value);
nums=num1*num2;
document.getElementById('product_price_total_' + productid).value = nums;

num1=Number(document.getElementById('product_quantity_' + productid).value);
num2=Number(document.getElementById('product_duration_' + productid).value);
nums=num1*num2;
document.getElementById('product_duration_total_' + productid).value = nums;

num1=Number(document.getElementById('product_quantity_' + productid).value);
num2=Number(document.getElementById('product_dives_' + productid).value);
nums=num1*num2;
document.getElementById('product_dives_total_' + productid).value = nums;

num1=Number(document.getElementById('product_quantity_' + productid).value);
num2=Number(document.getElementById('product_hire_' + productid).value);
nums=num1*num2;
document.getElementById('product_hire_total_' + productid).value = nums;

So now we need a script that gives us the Grand Total Price of all of the — ‘product_price_total_’ + productid).value — and another for Grand Total Duration, and a third for Grand Total Dives etc.. etc…

Not sure how but a few ideas would be an array that added up only fields with a specific alt tag or title tag.

Anyone got any ideas.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T07:37:04+00:00Added an answer on May 18, 2026 at 7:37 am

    How about something like this?
    (Using the same $() function as Šime Vidas above)

    var productIds = {};
    
    function product_totals(id) {
        productIds[id] = true; // store all id's as the totals are calculated
        ....
    }
    
    function totalTotals() {
        var totalPriceTotal = 0;
        var totalDurationTotal = 0;
        var totalDivesTotal = 0;
        var totalHireTotal = 0;
    
        for (var id in productIds) {
            // multiply by 1 to make sure it's a number
            totalPriceTotal += $('product_price_total_' + id).value*1;
            totalDurationTotal += $('product_duration_total_' + id).value*1;
            totalDivesTotal += $('product_dives_total_' + id).value*1;
            totalHireTotal += $('product_hire_total_' + id).value*1;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that performs calculations live as the user enters data. However,
i have a client who says they want an messaging based app which has
Problem: I have a page that has a large form, and in the middle
Hi all I am calculating a fractal and drawing a bufferedImage based on the
I'm having a windows form. In this form I've datagrid control which has few
I've been given a task to convert a simple spreadsheet to a HTML form
i have an user form which he has to fill before moving on to
I have a form. This form submits via POST to an iframe, that, in
I've searched. I really have and I've given up. I have a DataGridView that
I have a form-1 which has 4 fields. when the user inputs data in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.