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

The value entered does not match the format of the field; java script

New Here ,
Feb 19, 2018 Feb 19, 2018

I created a custom script that equates a percentage and that works fine. However, I get the error message of "the value entered does not match the format of the field". I believe that by other discussions I have read that I need to set a script that ensures the field has a non-zero value but don't know how to write it. My current calculation is: event.value = this.getField("Sponsor Total").value/this.getField("Overall Project Total").value

TOPICS
Acrobat SDK and JavaScript , Windows
1.3K
Translate
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 , Feb 19, 2018 Feb 19, 2018

var numerator = +getField("Sponsor Total").value;

var denominator = +getField("Overall Project Total").value;

event.value = denominator !== 0 ? numerator / denominator : "";

That last line translated to English would be: If the denominator is not equal to zero, set this field's value to the numerator divided by the denominator. Otherwise, make it blank.

Translate
LEGEND ,
Feb 19, 2018 Feb 19, 2018

var numerator = +getField("Sponsor Total").value;

var denominator = +getField("Overall Project Total").value;

event.value = denominator !== 0 ? numerator / denominator : "";

That last line translated to English would be: If the denominator is not equal to zero, set this field's value to the numerator divided by the denominator. Otherwise, make it blank.

Translate
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
New Here ,
Feb 20, 2018 Feb 20, 2018

Thank you, George...worked like a charm!

Translate
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 ,
Oct 20, 2020 Oct 20, 2020
LATEST

Here's an article that covers this exact topic:

https://www.pdfscripting.com/public/Value-Entered-Does-Not-Match-Format.cfm?sd=40

 

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

Translate
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