Need help with "value entered doesn't match the format" in my PDF

Community Beginner ,
Apr 09, 2018

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.

Most Valuable Participant
Correct answer by Test Screen Name | Most Valuable Participant

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.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

203

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

Need help with "value entered doesn't match the format" in my PDF

Community Beginner ,
Apr 09, 2018

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.

Most Valuable Participant
Correct answer by Test Screen Name | Most Valuable Participant

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.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

204

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
Apr 09, 2018 0
Most Valuable Participant ,
Apr 09, 2018

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.

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...
Apr 09, 2018 0
Adobe Community Professional ,
Apr 09, 2018

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.

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...
Apr 09, 2018 1
Community Beginner ,
Apr 10, 2018

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

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...
Apr 10, 2018 0
Most Valuable Participant ,
Apr 10, 2018

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;

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...
Apr 10, 2018 1
Most Valuable Participant ,
Apr 10, 2018

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.

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...
Apr 10, 2018 0
Community Beginner ,
Apr 10, 2018

Copy link to clipboard

Copied

I found the solution.  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...
Apr 10, 2018 1