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.
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;
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;
Copy link to clipboard
Copied
Don't use same export values for several entries.
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?
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
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.
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_
Copy link to clipboard
Copied
Works perfect! Thank you!