• 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 Simple Division on Fillable PDF / Java (see image)

Community Beginner ,
Jan 30, 2025 Jan 30, 2025

Copy link to clipboard

Copied

Im getting the dreaded "value doesnt match format" pop up.  I have sucessfully created my first fillable PDF but now I need someone to help me with the java

 

I have never "done" java ... and I am a newbie at best with creating PDFs and adobe.

 

Here is what I am trying to do.  Its super basic I just dont know anything about Java

 

example:

 

Text30 = Text27/Text28

 

Text29 = Text27/total

 

Text33 = Text26/total

 

Text34 = Text26/Text28

 

I realize the errors are popping up due to my simple formulas having empty blanks that are "seen" as zeros ...

 

for Text30 = Text27/Text28 I did try this to no avail:

 

var Text27 = this.getField("Text27").value;

var Text28 = this.getField("Text28").value;

 

if (Text28 !== 0) {

    event.value = Text27 / Text28;

} else { event.value = "Divsion by zero!"; // Handle the case of division by zero 

}

 

Screen Shot 2025-01-30 at 3.35.34 PM.png

TOPICS
How to , JavaScript , PDF forms

Views

63

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
1 ACCEPTED SOLUTION
Community Expert ,
Jan 30, 2025 Jan 30, 2025

Copy link to clipboard

Copied

PDF doesn't support Java, so you'll have to use JavaScript.

 

var text27 = this.getField("Text27").value;
var text28 = this.getField("Text28").value;
if (text28 != 0 && text28 != "" && text27 != "") {event.value = text27 / text28;}
else {event.value = "";}

 

 

 

 

 

 

View solution in original post

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 ,
Jan 30, 2025 Jan 30, 2025

Copy link to clipboard

Copied

PDF doesn't support Java, so you'll have to use JavaScript.

 

var text27 = this.getField("Text27").value;
var text28 = this.getField("Text28").value;
if (text28 != 0 && text28 != "" && text27 != "") {event.value = text27 / text28;}
else {event.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
Community Beginner ,
Jan 31, 2025 Jan 31, 2025

Copy link to clipboard

Copied

LATEST

my mistake.  when I said java I meant javascript.   thanks for the insight to this!  

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 ,
Jan 30, 2025 Jan 30, 2025

Copy link to clipboard

Copied

"Im getting the dreaded "value doesnt match format" pop up"

This is because you're trying to put the "Divsion by zero!" string in a field that uses the "Number" format.

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 ,
Jan 30, 2025 Jan 30, 2025

Copy link to clipboard

Copied

See this article:

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

 

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