Copy link to clipboard
Copied
I have a form that has data entry field called SW (setup as required, number to 1 decimal point) then results field (SW6, view, number to 1 decimal point) simplified field notation 45/SW, the form does the calculation but i get the error "the value entered does not match the format of the field
SW field will only have possible entry of 1 thru 8
In the same form I have another data entry field AW (setup as required, number to 1 decimal point), then another results field (AW6) which does a simplified field notation AW*45, which does not get the error.
I've tried various things like removing required, or view, does not make a difference.
Not sure what to do. Why does it work in one spot and not the other?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I repeat, the error is from division by zero when the field is empty. Use the following custom calculation script instead:
if(this.getField("SW").value)
{event.value=45/this.getField("SW").value}
else
{event.value=""}
Copy link to clipboard
Copied
Hi @michelle_8298 ,
This simplified field notation (SFN) of 45 divided by a value entered in field SW (45/SW) seems OK.
However, as explained in the article linked below, Field Names are interpreted as operands. Besides that point, it seems like using SFN in Acrobat is a little clunky when emplying a division like that.
In which case, because the entire line of characters in that code is all stuck together, try doing it like : (45)/SW , (45+0)/SW or using a space 45 / SW.
After testing it like that a few times, it didn't throw that error if I switched it back to 45/SW
Copy link to clipboard
Copied
The problem occurs when the SW field is empty. Division by zero returns Infinity which throws an error when forced into a number-formatted field (see link in my post below).
Copy link to clipboard
Copied
Yup!
Disregard my answer.... I was wrong. The issue came back.
Copy link to clipboard
Copied
I tried each one of the combinations and still get the same error. The calculation works on all of the combinations
Copy link to clipboard
Copied
If you change the value in the SW field, do you still get the error? My article posted below explains how to troubleshoot the error.
Copy link to clipboard
Copied
when I view the pdf in a browser everything works fine no errors. When i view the pdf in acbrobat reader dc I get the error.
When i'm in acrobat in edit mode and do a preview works with no errors, but when I clear the form that is where I get the errors as well.
Copy link to clipboard
Copied
I repeat, the error is from division by zero when the field is empty. Use the following custom calculation script instead:
if(this.getField("SW").value)
{event.value=45/this.getField("SW").value}
else
{event.value=""}
Copy link to clipboard
Copied
The solution is here:
https://pdfautomationstation.substack.com/p/mathematical-errors-in-pdf-forms
Copy link to clipboard
Copied
great, that works now, thanks so much