Copy link to clipboard
Copied
Need help with "value entered doesn't match the format" in my PDF. This message pops up every time I tab to a new field when entering data.
The message is correct. In arithmetic, blank is the same as zero. Division by zero is impossible. Instead of crashing it creates a special result which is Not A Number.
You must write code to check the value before you divide by it.
Copy link to clipboard
Copied
My guess is you have a script that uses division and the divisor is the value of another field. When that field is blank (or zero) the result is an illegal operation. Try searching the forums for division scripts. This issue was discussed many times in the past.
Copy link to clipboard
Copied
The problem, as stated in the messages, is that the value of a field doesn't match the stated formatting. This happens most often with calculated fields that have a number format, where the calculation turns out to be something other than a number. Usually because of missing data.
Here's what you do. Remove the formatting from each field one at a time until the message goes away. Then examine the field to determine what is causing it to produce the message.
Copy link to clipboard
Copied
Here is my formula:
event.value = (this.getField("Text2").value - this.getField("FROM_2").value) / this.getField("FROM_2").value;
Lines "Text2" and "FROM_2" are blank until the information is filled in by the employees and also formatted as a percentage.
I keep getting the error
Copy link to clipboard
Copied
As I thought, you're diving by a value of a field.
Change your code to:
if (Number(this.getField("FROM_2").valueAsString)==0) event.value = "";
else event.value = (this.getField("Text2").value - this.getField("FROM_2").value) / this.getField("FROM_2").value;
Copy link to clipboard
Copied
The message is correct. In arithmetic, blank is the same as zero. Division by zero is impossible. Instead of crashing it creates a special result which is Not A Number.
You must write code to check the value before you divide by it.
Copy link to clipboard
Copied
I found the solution. Thanks!