Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Over ride a field formula if 0 is entered

Explorer ,
Jun 27, 2017 Jun 27, 2017

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

TOPICS
Acrobat SDK and JavaScript
923
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jun 30, 2017 Jun 30, 2017

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

...
Translate
Community Expert ,
Jun 28, 2017 Jun 28, 2017

The error is?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 28, 2017 Jun 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 28, 2017 Jun 28, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 29, 2017 Jun 29, 2017

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 29, 2017 Jun 29, 2017

Sorry, I have attached the form via Dropbox

Acrobat : File menu : Send File : Send & Track : Create anonymous link


Acrobate du PDF, InDesigner et Photoshopographe
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 29, 2017 Jun 29, 2017
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 29, 2017 Jun 29, 2017

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 29, 2017 Jun 29, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 30, 2017 Jun 30, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 06, 2017 Jul 06, 2017
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 29, 2017 Jun 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines