Long Hours of Design

December 12, 2008

PDF Forms—Hide Zero Sum(s)

Filed under: How-To, Tips and Tricks — Tags: , , , , — admin @ 12:32 pm
Now and again, in every designers life, a little PDF form must fall.

At some point, we’ve probably all tackled creating a PDF form.

And, much like Hurcules must have done after being assigned his twelve labours, we uttered a lament of utter despair — “Oooohhhh, man! Do I have to?” [ 1 ]

That said, here’s a simple tip relating to calculations in forms and zero sums.

Zero Sums

Lets say you want someone to click several options (“Item 1”, “Item 2”, “Item 3”) and you set Acrobat to automatically sum the total.

Acrobat will display “0” in the results field when nothing is clicked. Sometimes, you just don’t want the “0” to display.

To hide this “0” until you’ve got an actual value:

  1. Enter your “Calculate” properties as you normally would
  2. Enter this javascript into the “Run Custom Validation Script” field, under the “Validate” portion of the properties box.
if (event.value == 0) event.value = ""; 

Violá! The zero is hidden.

  1. Alternate laments:  “I don’t want to!”, “Acrobat! But, Acrobat SUCKS!” and, of course, “Can’t the intern do it?”