• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

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

TOPICS
Acrobat SDK and JavaScript , Windows

Views

449

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
community guidelines

correct answers 1 Correct answer

LEGEND , Apr 10, 2018 Apr 10, 2018

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.

Votes

Translate

Translate
Community Expert ,
Apr 09, 2018 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.

Votes

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
community guidelines
Community Expert ,
Apr 09, 2018 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.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

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
community guidelines
Community Beginner ,
Apr 10, 2018 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

Votes

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
community guidelines
Community Expert ,
Apr 10, 2018 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;

Votes

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
community guidelines
LEGEND ,
Apr 10, 2018 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.

Votes

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
community guidelines
Community Beginner ,
Apr 10, 2018 Apr 10, 2018

Copy link to clipboard

Copied

LATEST

I found the solution.  Thanks!

Votes

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
community guidelines