Question
JavaScript code for assigning different values to entry fields of constant sum
After trying to edit existing code I found from tangentially related questions, I figured it might be easier to just ask as I feel like there should be a more simplistic answer. I am trying to create a constant sum question that will calculate the total based on the dollar amounts assigned to each of four fields (i.e., entry field 1 is worth $5, entry field 2 is worth $10, etc.). I am essentially trying to perform a cross product calculation that will add to 100, but the number of "items" selected will actually sum to much less. JavaScript isn't my forte, but I do the ability to go in an edit some existing code if there is anything out there on this.
Any guidance on how this can be done?
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

Given $100, participants will choose the combination of items they want. The total of the selection right now sums to 5, whereas I'd like for it to show $55 (the sum of the products of the number selected and the price of each item). I guess it might be helpful if the total box started with the amount allocated and subtracted (e.g., $45 would show in the example above since $55 worth of the allocation has been used). Not sure if using a single column matrix would be a better format, but even then I am still faced with the problem of the calculation running correctly.