Skip to main content
Participant
August 25, 2023
Question

How to auto populate quantities using 2 drop-down menus

  • August 25, 2023
  • 1 reply
  • 3418 views

Hi, new business owner & new Adobe user here. A couple days into using it & I feel like what I'm looking for is probably super simple for most. If I get the answer here, it will save me an embarrassing amount of time trying to figure it out myself. I'll try my best to explain.

We're creating a form for large quantity clothing orders.
It has 2 drop-down menus (Style: Adult, Youth) and (Size: xs through 4xl) followed by the quantity column. At the bottom of the form I'd like it to auto populate the quantity breakdown - how many Youth XS, how many Adult XS, etc. 

I have the items & values done in the drop downs but I have know idea what the custom script would look like to calculate totals.

Any help would be greatly appreciated.

thanks!

 

 

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
August 25, 2023

It's actually not that trivial. You would need to use a for-loop to iterate over all the fields, checking each pair for a certain value, and then incrementing the value of a counter variable if they match what you're after, applying the value of that variable to the total field at the end of the process.

If you let us know what are the names of the fields involved I could help you with a sample code for this.

Participant
August 26, 2023

I wasn't expecting such a quick response & I really appreciate it. It sounds like this is something i wouldnt have figured out on my own. I attached photos of the form hoping that is more helpful then an explanation from me. I made the export value for each selection in the drop-down menus 1

Participant
August 26, 2023

I made a small mistake, but it should still show "1" in the output fields... For it to sum the quantities you should change this line:

count++;

To:

count+=Number(this.getField("QTY"+i).valueAsString);

If it still doesn't work you'll need to share the actual file for further help.


I tried & it didnt work, I've attached the file. I appreciate your help but i dont want to take up much more of your time. If it doesnt work, i can have clients manually enter the numbers. There seems to be frequent errors when the info is entered manually, I was hoping to reduce the errors this way. But it's not a big deal if it doesnt workout.