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

Refresh control

New Here ,
Mar 29, 2018 Mar 29, 2018

Copy link to clipboard

Copied

I have a pdf where the user enters info and the last page does all the calculation.  The calculation is done in the fields, it involves averages.  It is slow because each time any information is entered all the fields on the last page recalulates.  I would like to switch off recalculation on that page until the user clicks a "calculate" button.  Is that possible?

Or even if I could switch off refresh for the entire document until a button is clicked.

I found this code but I am not sure where to put it or how to make it work.  Can anyone help?

Thanks in advance

{

        this.delay = true;

}

{

        this.delay = false;

}

TOPICS
Acrobat SDK and JavaScript , Windows

Views

1.1K

Translate

Translate

Report

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

Community Expert , Mar 30, 2018 Mar 30, 2018

Yes: this.calculateNow();

Votes

Translate

Translate
Community Expert ,
Mar 29, 2018 Mar 29, 2018

Copy link to clipboard

Copied

You can use the calculations at the "calculate" button.

Votes

Translate

Translate

Report

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
New Here ,
Mar 29, 2018 Mar 29, 2018

Copy link to clipboard

Copied

Would I then put all the calculations into the button?  There are a lot of cacluations in the fields involving mean average.  I would not know how to start this in javascript.  Perhaps I have not been clear, I need the fields on page 9 of my document or my whole document not to caculate until I press a button. Many thanks

Votes

Translate

Translate

Report

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 ,
Mar 29, 2018 Mar 29, 2018

Copy link to clipboard

Copied

What calculations do you use?

Votes

Translate

Translate

Report

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
New Here ,
Mar 29, 2018 Mar 29, 2018

Copy link to clipboard

Copied

Hi Bernd

I am pulling the values from a number of fields and using the average function. Then I pulling information from those fields to make a mean average.  The field calculation works a treat. No complaints.  It is just that for speed I want them to do the calculation at the end once all the data has been entered.

Many thanks for any help you can give

Votes

Translate

Translate

Report

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 ,
Mar 29, 2018 Mar 29, 2018

Copy link to clipboard

Copied

Use the "calculate" property, instead.

Votes

Translate

Translate

Report

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
New Here ,
Mar 29, 2018 Mar 29, 2018

Copy link to clipboard

Copied

Hi,

Thanks for your reply

Not sure what the calculate property is?

Votes

Translate

Translate

Report

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 ,
Mar 29, 2018 Mar 29, 2018

Copy link to clipboard

Copied

Instead of "this.delay" use "this.calculate".

Votes

Translate

Translate

Report

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
New Here ,
Mar 29, 2018 Mar 29, 2018

Copy link to clipboard

Copied

Ok.

Would I put this in a button?

That would make the fields calculate but I need then to NOT calculate until I press the button.

How would I stop the fields from refreshing?

I am a beginner with javascript so what would the syntax be?

Votes

Translate

Translate

Report

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
New Here ,
Mar 29, 2018 Mar 29, 2018

Copy link to clipboard

Copied

Brilliant!! Got it.  I did 2 buttons 1 to turn the calculations off 1 to turn them on.  Thank you so much.

Now, is there a way to automatically turn off the calculation with a document is opened?

That way I would only need 1 button to calculate the end page?

Votes

Translate

Translate

Report

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 ,
Mar 29, 2018 Mar 29, 2018

Copy link to clipboard

Copied

Yes, add the code to stop the calculation under Tools - JavaScript - Document JavaScripts.

Votes

Translate

Translate

Report

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
New Here ,
Mar 30, 2018 Mar 30, 2018

Copy link to clipboard

Copied

Thanks to both.

Works.  Only thing I am left with is when I click the button to switch back on calculation I then have to enter information in any field to make the document refresh and calculate all fields.  Is there a sub command I could put in the this.calculate button that makes it calculate NOW.

Again, many thanks in advance, much appreciated

Votes

Translate

Translate

Report

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 ,
Mar 30, 2018 Mar 30, 2018

Copy link to clipboard

Copied

Yes: this.calculateNow();

Votes

Translate

Translate

Report

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
New Here ,
Mar 31, 2018 Mar 31, 2018

Copy link to clipboard

Copied

LATEST

Just wanted to say thanks again. Help much appreciated, especially for a beginner

Votes

Translate

Translate

Report

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