Skip to main content
Known Participant
Mar 16, 2017 9:17 PM UTC
Question

if calculation = 0, view but do not print

Calculation results in a zero which appears in the field.  My form will be used for both online and hand-written completion.  I am K with keeping the 0 when viewing and/or completing online, but do not want it to print   Is there a validation script?

This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

JR Boulay
Community Expert
Community Expert
Mar 17, 2017 9:48 AM UTC

Hi.

Assuming that the form have a white background, I use a Validation script that colors the number to white if = zero.

So it's invisible on the screen and on the paper.

event.target.textColor = event.value == 0 ? color.white : color.black;

Translate
Acrobate du PDF, InDesigner et Photoshopographe
MinusZero
Participating Frequently
Mar 17, 2017 6:20 AM UTC

Not sure if you are using LiveCycle, but it you are. This is pretty basic.

In the form's preprint event use:

if (this.resolveNode("TextField1").rawValue == "0") {

  this.resolveNode("TextField1").presence = "invisible";

}

and in the postprint event use:

if (this.resolveNode("TextField1").rawValue == "0") {

  this.resolveNode("TextField1").presence = "visible";

}

When the form is printed (or cancelled before printing, if the textfield is 0, the field is made invisible. After printing, if the field is 0 (which it would still be), then it will be made visible again.

Translate