Copy link to clipboard
Copied
Hi
I am using Adobe Acrobat Pro DC (V2015.006.30097)....I am very new to Adobe Javascript and am trying to work out a formula which will over ride the formula if I type in a 0 . It is a finance form and some amounts do not incur GST (Tax) .
I have the NETT AMOUNT + GST = TOTAL
I started with a very basic formula of Amount1*.1 in the GST Field and Amount1+GST in the TOTAL field - however if GST is not added to the item and type in "0" to reflect this in the GST box, it does not allow this, it keeps adding the 10% onto the GST field.
so I tried this variance in the calculation text field property (after searching the forum for some ideas)
var nGST = this.getField("GST").value;
if( nGST > 0.0) event.value = nGST * 0.10;
but I am now getting an error.
I would really appreciate some help
Thanks
The form has to have some way to determine if GST needs to be computed on an amount or not. The amount is not enough to determine if the calculation needs to made. There has to be another entry along with the amount so the script can determine if the calculation needs to be preformed or not. It could be simple check box to indicate that GST needs to be computed or a description of the item or type of item that can be used to determine if the GST needs to be computed or not. For the last I would
...Copy link to clipboard
Copied
The error is?
Copy link to clipboard
Copied
We need to know the exact wording of the error being reported.
It looks like you have a field named "Net Amount". Does this field calculate correctly?
It might even be helpful if you can provide a link to a sample form with this error. We could then download the sample form and see the entire process. The error could be in a form field before your tax calculation.
Copy link to clipboard
Copied
@gkaiseril
Sorry, I have attached the form via dropbox, it's not on our work server yet but I hope this works..
I have removed this formula
var nGST = this.getField("GST").value;
if( nGST > 0.0) event.value = nGST * 0.10;
And left the very basic formula in the total field. So now I don't get an error but the form won't allow me to put in a zero dollar value in the GST Field.
Here is the link to the form -
https://www.dropbox.com/l/scl/AAAct97stE0c5swmRI8mfmDDqV2vshp2WqY
thanks
Copy link to clipboard
Copied
You didn't specify in your code what should be the value if the GST field is blank or equals zero...
Copy link to clipboard
Copied
Sorry, I have attached the form via Dropbox
Acrobat : File menu : Send File : Send & Track : Create anonymous link
Copy link to clipboard
Copied
Thanks @JR_Boulay - now attached properly
https://files.acrobat.com/a/preview/6d1534a2-da8d-4ebd-bdf5-6db3d12a4f80
Copy link to clipboard
Copied
How does one know when to apply or not apply the GST?
There has to some trigger or value or description that could be used to determine if the GST needs to be computed or not.
Conditional execution and Acrobat JavaScript by Thom Parker
Copy link to clipboard
Copied
gkaiseril -
not all goods and services have GST in Australia - it depends what it is.
I have printed out the Thom Parker article and will have a read through it too.
Copy link to clipboard
Copied
The form has to have some way to determine if GST needs to be computed on an amount or not. The amount is not enough to determine if the calculation needs to made. There has to be another entry along with the amount so the script can determine if the calculation needs to be preformed or not. It could be simple check box to indicate that GST needs to be computed or a description of the item or type of item that can be used to determine if the GST needs to be computed or not. For the last I would use a drop down list that is prepopulated with categories or descriptions of what the amount represents and from that list a script could make a decision as to whether GST needs to be calculated or not.
Copy link to clipboard
Copied
Thanks gkaiseril - I will give that a try. Sorry for the delayed response, working on other issues at the moment. going to give this a go today.
Copy link to clipboard
Copied
It's not "properly", for a PDF form opened in Acrobat it's just quickly or easily.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now