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

Refresh control

New Here ,
Mar 29, 2018 Mar 29, 2018

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
1.7K
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

Community Expert , Mar 30, 2018 Mar 30, 2018

Yes: this.calculateNow();

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

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

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

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

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

What calculations do you use?

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

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

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

Use the "calculate" property, instead.

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

Hi,

Thanks for your reply

Not sure what the calculate property 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
Community Expert ,
Mar 29, 2018 Mar 29, 2018

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

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

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?

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

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?

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

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

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

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

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

Yes: this.calculateNow();

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

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

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