Skip to main content
Participating Frequently
June 28, 2017
Answered

Over ride a field formula if 0 is entered

  • June 28, 2017
  • 3 replies
  • 1022 views

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

This topic has been closed for replies.
Correct answer gkaiseril

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.


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.

3 replies

JR Boulay
Community Expert
Community Expert
June 29, 2017

It's not "properly", for a PDF form opened in Acrobat it's just quickly or easily.

Acrobate du PDF, InDesigner et Photoshopographe
Inspiring
June 28, 2017

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.

LisonaliAuthor
Participating Frequently
June 29, 2017

@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

try67
Community Expert
Community Expert
June 29, 2017

You didn't specify in your code what should be the value if the GST field is blank or equals zero...

Bernd Alheit
Community Expert
Community Expert
June 28, 2017

The error is?