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