Variable Export Values with Drop Menu Choices

Explorer ,
Mar 14, 2021 Mar 14, 2021

Copy link to clipboard

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

Translate

Translate

Report

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

correct answers 1 Correct Answer

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

Translate

Translate
Adobe Community Professional ,
Mar 14, 2021 Mar 14, 2021

Copy link to clipboard

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

Translate

Translate

Report

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
Adobe Community Professional ,
Mar 14, 2021 Mar 14, 2021

Copy link to clipboard

Copied

Don't use same export values for several entries.

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Mar 14, 2021 Mar 14, 2021

Copy link to clipboard

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

Translate

Translate

Report

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
Adobe Community Professional ,
Mar 14, 2021 Mar 14, 2021

Copy link to clipboard

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

Translate

Translate

Report

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
Adobe Community Professional ,
Mar 14, 2021 Mar 14, 2021

Copy link to clipboard

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

Translate

Translate

Report

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
Adobe Community Professional ,
Mar 14, 2021 Mar 14, 2021

Copy link to clipboard

Copied

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

https://drive.google.com/uc?export=download&id=17kqk3pLZ5ZdT68y7QNPv1OlaSgSoLOJ_ 

 

Likes

Translate

Translate

Report

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
Explorer ,
Mar 14, 2021 Mar 14, 2021

Copy link to clipboard

Copied

LATEST

Works perfect!  Thank you!

 

Likes

Translate

Translate

Report

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