Click to See Complete Forum and Search --> : Form computation problem


podie1
05-19-2003, 10:10 AM
I wrote code to have my form figure out shipping totals based on the quantity of bottles a customer purchases. For some reason, you have to click the total button twice before it will bring in the shipping total. Any suggestions? I am having a hard time figuring this one out. Also, if you change the bottles you want to purchase and press total, it is like it is going thru the code until it gets to the correct shipping total and then it will choose it.

Thanks for any help I can get.

Jodi

AdamGundry
05-19-2003, 10:16 AM
There's little we can suggest without some code. Post a link to your script.

Adam

podie1
05-19-2003, 10:33 AM
Okay here is my form.


Thanks,

JodiOrder Form (http://www.geocities.com/paddocklke/formsame.html)

khaki
05-19-2003, 11:38 PM
sorry to intrude on this thread...
but...
HAPPY BIRTHDAY ADAM!!! :)

;) K

2 peachy
05-19-2003, 11:45 PM
me too ...sorry to interupt...
Happy Birthday Adam....

Jona
05-19-2003, 11:50 PM
I second, err... Third that!

HAPPY
BIRTHDAY!!!!

2 peachy
05-19-2003, 11:53 PM
Jona... how did you get happy birthday in rainbow ?

Jona
05-19-2003, 11:54 PM
Lol, I just put each letter in a different <color> tag (in UBB code of course).. All manually.

khaki
05-19-2003, 11:55 PM
Congratulations on your 100th post Peachy!!!

;) k

2 peachy
05-20-2003, 12:21 AM
laffin.... well... you guys are so great, I know I can get help from you.... lol

AdamGundry
05-20-2003, 03:12 AM
Thanks very much guys. :) My birthday :D , and I get GCSE English Lit the next day :( .

Looks like this thread has bene hijacked - Jodi, I've downloaded your code and can't see anything immediately wrong with it, but I'll fiddle with it and try to get it to work.

Adam

Gollum
05-20-2003, 03:42 AM
Just had a peek at the site...

you are using a hidden field called TotalQty to hold the number of items being shipped and this is what you are basing your shipping charge on

trouble is, you are calculating your shipping charge before you update the TotalQty hidden value. So the first time you hit the TOTAL button, TotalQty will have a value of "" (empty string) and so your calculation will be based on that.
The second time, TotalQty will have the number of items there were the last time TOTAL was clicked, and so on.

I noticed that you have a variable called STotalQty that you calculate before the shipping charge, you could use this instead of using the TotalQty, e.g.

STotalQty = (HM + LM + AM);

if (STotalQty == 1){SShipping = 450};
if (STotalQty == 2){SShipping = 700};
if (STotalQty == 3){SShipping = 700};
etc

PS you may wish to check for negative values on quantities

PPS Happy Birthday Adam :cool:

podie1
05-20-2003, 08:12 AM
THANKS!!! IT WORKED. My boss will be happy now.

Jodi