Skip to main content
KC_
New Participant
March 22, 2019
Answered

Hide Calculated unused $0.00 form fields.

  • March 22, 2019
  • 5 replies
  • 14419 views

Hello, I have an excel spreadsheet that I have turned into a form with Adobe Acrobat Pro that has a qty field, a price field and a total field, among others. I have set the total field to automatically calculate to the product of the Qty field and price field, which works fine. The issue is that by default it displays a zero (or actually, $0.00, since I have it formatted to price), and so if people print out the form to fill it out manually, they have to cross out the zero.

Is custom javascript the only way to get the field to be conditionally hidden or non-printable? If not, can you tell me a better method? If so, can you point me to an example of this that works? I can provide screenshots if necessary.

Correct answer try67

As the custom validation script of the field enter this:

if (event.value==0) event.value = "";

5 replies

New Participant
September 20, 2022

Type this script into the DEFAULT VALUE box on the OPTION tab (not the RUN CUSTOM VALIDATION SCRIPT on the VALIDATE tab) .  This fixed the issue for me.

 if (event.value==0) event.value = ""

Nesa Nurani
Adobe Expert
September 20, 2022

That is not possible. You must have a script somewhere else that works for you.

Thom Parker
Adobe Expert
August 9, 2020

Here's an article that discusses this topic in detail:

https://www.pdfscripting.com/public/How-to-set-000-value-to-blank.cfm

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participating Frequently
August 3, 2020

This is close to the problem I'm having. I have estimated days of inventory on hand (Text53)  as a calculation. Quantity on Hand (Text52) divided by Daily Usage (Text51). So in the simplified field notation I have: Text52/Text51. Only problem is I get errors when I set properties on Text53 to number. I get Java errors. (The Value entered does not match the format of the field [ Text53] So I leave it at none but then it keeps putting NaN in the cell if a number was entered and then cleared. When I clear the form the NaN stays there. I'd like it to go to blank if anything or 0.

Bernd Alheit
Adobe Expert
August 3, 2020

You will get NaN when you divide by zero.

Participating Frequently
August 3, 2020

So how do you get it display blank instead of NaN?

New Participant
February 10, 2020

This isn't working for me. I also have my field formatted to dollar figure. My field's name is ClosingBalance.

I'm inserting 

if (event.value==0) event.value = "";

in the "Run custom validation script" box. 

Thom Parker
Adobe Expert
February 10, 2020

Post your question to a new thread

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
try67
try67Correct answer
Adobe Expert
March 22, 2019

As the custom validation script of the field enter this:

if (event.value==0) event.value = "";

try67
Adobe Expert
March 22, 2019

PS. In the future you'll be better off posting questions about Acrobat in the Acrobat forums, like this one: PDF Forms