Click to See Complete Forum and Search --> : Pdf Calculation Problem


Porcupine
03-20-2003, 08:06 AM
I am trying to create an order form in Adobe Acrobat PDF format. This code seems to be close, but not quite there. Can anyone help?

var f = this.getField ("TOTAL");
if (f.value=0.00<20.00)(event.value=5.95);"or";
if (f.value=20.01<50.00)(event.value=7.95);"or";
if (f.value=50.01<75.00)(event.value=9.95);"or";
if (f.value=75.01<100.00)(event.value=11.95);"or";
if (f.value=100.01<150.00)(event.value=13.95);"or";
if (f.value=150.01<200.00)(event.value=15.95);"or";
if (f.value=200.01<250.00)(event.value=17.95);"or";
if (f.value>250.01)(event.value=20.95);

Thanks!!

jalarie
03-20-2003, 08:28 AM
I know nothing about Acrobat, but I do know that "if" statements can be linked too deeply and that specifying ranges can be messy, so I'll take a stab at it:

var f = this.getField ("TOTAL");
event.value=5.95
if (f.value>20.00)(event.value=7.95);
if (f.value>50.00)(event.value=9.95);
if (f.value>75.00)(event.value=11.95);
if (f.value>100.00)(event.value=13.95);
if (f.value>150.00)(event.value=15.95);
if (f.value>200.00)(event.value=17.95);
if (f.value>250.00)(event.value=20.95);

Porcupine
03-20-2003, 08:36 AM
Thank you!! This worked great...to a point. It inserted the proper number, but when the "TOTAL" changed, the number did not.

Any further ideas?

jalarie
03-20-2003, 08:42 AM
Whatever triggers this calculation the first time has to be reactivated to trigger it again when the main field changes. Sorry about my lack of knowledge in Acrobat. In JavaScript, I would put those lines within a function and add "onchange='function_name();'" to the main field.

Porcupine
03-20-2003, 08:52 AM
Thank you Jalarie. I will try this when I get home from work.

jalarie
03-20-2003, 09:02 AM
I'm sorry that I couldn't be of more help, but I don't have Acrobat.