Refresh control

New Here ,
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;

}

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Yes: this.calculateNow();

TOPICS
Acrobat SDK and JavaScript, Windows

Views

112

Likes

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

Refresh control

New Here ,
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;

}

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Yes: this.calculateNow();

TOPICS
Acrobat SDK and JavaScript, Windows

Views

113

Likes

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
Mar 29, 2018 0
Adobe Community Professional ,
Mar 29, 2018

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Mar 29, 2018 0
New Here ,
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

Likes

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
Reply
Loading...
Mar 29, 2018 0
Adobe Community Professional ,
Mar 29, 2018

Copy link to clipboard

Copied

What calculations do you use?

Likes

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
Reply
Loading...
Mar 29, 2018 0
New Here ,
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

Likes

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
Reply
Loading...
Mar 29, 2018 0
Most Valuable Participant ,
Mar 29, 2018

Copy link to clipboard

Copied

Use the "calculate" property, instead.

Likes

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
Reply
Loading...
Mar 29, 2018 0
New Here ,
Mar 29, 2018

Copy link to clipboard

Copied

Hi,

Thanks for your reply

Not sure what the calculate property is?

Likes

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
Reply
Loading...
Mar 29, 2018 0
Most Valuable Participant ,
Mar 29, 2018

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Mar 29, 2018 0
New Here ,
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?

Likes

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
Reply
Loading...
Mar 29, 2018 0
New Here ,
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?

Likes

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
Reply
Loading...
Mar 29, 2018 0
Most Valuable Participant ,
Mar 29, 2018

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Mar 29, 2018 0
New Here ,
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

Likes

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
Reply
Loading...
Mar 30, 2018 0
Most Valuable Participant ,
Mar 30, 2018

Copy link to clipboard

Copied

Yes: this.calculateNow();

Likes

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
Reply
Loading...
Mar 30, 2018 1
New Here ,
Mar 31, 2018

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Mar 31, 2018 0