# Variable Export Values with Drop Menu Choices

Explorer ,
Mar 14, 2021 Mar 14, 2021

Copied

Creating a merchandise order form.

Text Box (QTY)

Drop Down Menu (SIZE) with selections (XS,S,M,L,XL,2XL, and 3XL)

Drop Down with Color (COLOR)

Text Box (TOTAL)

In the drop down menu (SIZE) I need the value for sizes XS, S, L, and XL to calculate \$25 and 2XL and 3XL to calculate at \$28 when selected.

Currently, (QTY) is Multiplying with (SIZE) to create (TOTAL) I just cant figure out how to have variable prices for size selection.

Thank you.

TOPICS
General troubleshooting, How to, JavaScript, PDF forms

Views

154

Likes

Report

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

Adobe Community Professional , Mar 14, 2021 Mar 14, 2021
EDIT:Try this code:var q = Number(this.getField("QTY").value); var s = this.getField("SIZE").valueAsString; var total = 0; if(s == "XS" || s == "S" || s == "M" || s == "L" || s == "XL") total = 25; else if(s == "2XL" || s == "3XL") total = 28; event.value = q*total;

Likes

7 Replies 7
Mar 14, 2021 Mar 14, 2021

Copied

EDIT:

Try this code:

var q = Number(this.getField("QTY").value);
var s = this.getField("SIZE").valueAsString;
var total = 0;
if(s == "XS" || s == "S" || s == "M" || s == "L" || s == "XL")
total = 25;
else if(s == "2XL" || s == "3XL")
total = 28;
event.value = q*total;

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 14, 2021 Mar 14, 2021

Copied

Don't use same export values for several entries.

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 14, 2021 Mar 14, 2021

Copied

Thanks Bernd, I thought so too, I actually just read other post where try67 and Thom said same thing but still I wanted give it a try since it's same price value, and using 'value is' to multiply with QTY didn't give me any errors ( at least from what I tested) so I thought It's safe to use it for this situation?

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 14, 2021 Mar 14, 2021

Copied

The issue is that you can't select all entries in the dropdown. Try it out.

You can use values like 28 and 28.0

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 14, 2021 Mar 14, 2021

Copied

I see, I was confused because first time I tried I added value and later I added export value and it was working for me, not sure why.

Il edit my post with another code, thanks.

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 14, 2021 Mar 14, 2021

Copied

This why i was confused because it worked for me in this file

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Mar 14, 2021 Mar 14, 2021

Copied

LATEST

Works perfect!  Thank you!

Likes

Report

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