I need a JavaScript for a calculation from a dropdown menu and checkbox
Copy link to clipboard
Copied
I need a JavaScript for a calculation in a PDF Fill-in form for a selection in a dropdown menu (for Customer Type) and checkbox for Daily1, Evening1, or Weekend1 and another checkbox for the room choice. Depending on the dropdown and with the two checkboxes chosen a price will be shown.
Copy link to clipboard
Copied
How many dropdown items you have and are prices different for each?
What are the prices for each items?
This would be much easier if you could share file.
Copy link to clipboard
Copied
There are 3 different dropdown choices.
A checkbox for Daily; Evening; Weekend across each column
The different rooms down the rows.
So first they would select from the Dropdown menu
then select daily, evening or weekend.
then select which rooms to use and that determines the price for each cell.
Copy link to clipboard
Copied
I could make you code but I can't whitout knowing what are 3 dropdown choices and where are prices.
can you share your file it would make things much easier?
Copy link to clipboard
Copied
Hi,
I would approach this by having some hidden fields to store certain costs in and then use them for the calculation.
for example:
Your drop down field changes so we place a value in a hidden field called dropdownValue (Call it $50)
Then they select a check box and we have place a value in timeValue ( Call it $50)
And then when they click the checkbox for room we can run a simple sum something like:
valueShowToCustomer = dropDownvalue + timeValue + roomValue;
// Which would be 50 + 50 + 50 = 150;
This would keep the JavaScript simple, and allow you to be able to change individual pieces without having to re-code the whole solution.
Let me know if you would like to take it further.
Regards
Malcolm

