Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

I need a JavaScript for a calculation from a dropdown menu and checkbox

New Here ,
Oct 06, 2020 Oct 06, 2020

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.

contract SRFTX 2020 - fillin_Page_01.jpgexpand image

TOPICS
PDF forms
677
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 06, 2020 Oct 06, 2020

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 08, 2020 Oct 08, 2020

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.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 08, 2020 Oct 08, 2020
LATEST

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 07, 2020 Oct 07, 2020

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines