Recalculate upon exiting a field

Feb 04, 2018

Copy link to clipboard

Copied

I have a form with 10 fields (type: number). The first field is Income. The remaining input fields are other payroll related numbers in which User would type a number or select from options that return a number. There are also ten other read-only fields that run calculations based on the input fields as user updates them. Because of "Order of Calculation", if User completes any number of input fields, and then wishes to test a different amount in Income in that first field, the calculable read-only fields are unaffected (in other words, the calculations remain related to the original Income input, not the updated Income input). My current solution is to have the entire form reset to zeros upon mouse-down in Income. This is an unsatisfactory semi-solution, because User must go through and re-type or select the remaining 9 fields again. I would rather have all the read-only fields simply recalculate upon mouse exit from Income.

If you know of a way to do this - especially without writing a long script that calls upon each of the read-only fields, individually, to recalculate (kind of a "Recalculate All" function), please let me know.

TOPICS
Acrobat SDK and JavaScript, Macintosh, Windows

Views

338

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

Recalculate upon exiting a field

Feb 04, 2018

Copy link to clipboard

Copied

I have a form with 10 fields (type: number). The first field is Income. The remaining input fields are other payroll related numbers in which User would type a number or select from options that return a number. There are also ten other read-only fields that run calculations based on the input fields as user updates them. Because of "Order of Calculation", if User completes any number of input fields, and then wishes to test a different amount in Income in that first field, the calculable read-only fields are unaffected (in other words, the calculations remain related to the original Income input, not the updated Income input). My current solution is to have the entire form reset to zeros upon mouse-down in Income. This is an unsatisfactory semi-solution, because User must go through and re-type or select the remaining 9 fields again. I would rather have all the read-only fields simply recalculate upon mouse exit from Income.

If you know of a way to do this - especially without writing a long script that calls upon each of the read-only fields, individually, to recalculate (kind of a "Recalculate All" function), please let me know.

TOPICS
Acrobat SDK and JavaScript, Macintosh, Windows

Views

339

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
Feb 04, 2018 0
Feb 04, 2018

Copy link to clipboard

Copied

Check the order the fields are calculated in and open the JavaScript console to see if there any script errors.

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...
Feb 04, 2018 1
Feb 04, 2018

Copy link to clipboard

Copied

Ok, will do. But, from your response I'm inferring if the fields are in proper order and there are no errors, then I would not have a problem and the fields should automatically recalculate when I change Income. Is that correct?

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...
Feb 04, 2018 1
Feb 04, 2018

Copy link to clipboard

Copied

Unless you turn off calculations they should recalculate whenever a field used in a calculation is changed.

If you change another field and the calculations update or some due then there is a problem.

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...
Feb 04, 2018 1
rsbisa LATEST
Feb 05, 2018

Copy link to clipboard

Copied

Thank you. After checking calculation order and no errors, I got rid of the Reset All Fields action and the form is working again. I must have had an error, earlier, and have since fixed it.

Thanks again.

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...
Feb 05, 2018 0