These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Acrobat 9 Forms Help

Rob M
Registered: Apr 8 2009
Posts: 6

Hi guys,

I've been trying to get this form to work for a few days, a pretty simple invoice for an architect I'm working for.

I''m trying to take a Sub Total from a series of Expense fields, which is all working fine.
Then I try and get 15% of this value for the VAT. I can get this to work but when I go back and amend the Expense fields, the VAT field doesn't update. The same can be said for the Invoice Total and Amount Due, they don't seem to update. The only way to get it to work is to manually go in and clear all the fields, but even that sometimes doesn't pick up the changes.

So, for the VAT fields and the other fields leading from that I've been using a script I found on here:

event.value = 0.15 * this.getField("Total exc VAT").value;

For Invoice Total

event.value =
1 *this.getField("Total exc VAT").value +
1 *this.getField("VAT at 15").value;

To have a play go here: www.manvsmachine.co.uk/paul_archer/Quote_03.pdf

Cheers,
Rob.

Rob M
Registered: Apr 8 2009
Posts: 6
No problems, I read some more posts and changed the calculation order, works a treat :)
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
This occurs because JavaScript is not very strict about string types and tries to guess whether to convert a character to a number or a number to a character, but seldom gets it right. So one can force a number to a string with the 'String()' constrictor and force a string numeric value to a number with the 'Number()' constrictor.

Using the 'Number()' constrictor to force blank fields to zero.

event.value = Number(this.getField("Total excl VAT").value)  +  Number(this.getField("VAT at 15").value);
One could also write a document function to perform a sum of the passed values similar to the 'Sum()' function in LiveCycle Designer. See [url=http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=18490]SUMIF Equivalent[/url] for an example that acts like the "Sumif' Excel function, but this could easily be converted to a 'Sum()' function.

George Kaiser