Skip to main content
Known Participant
March 16, 2017
Question

if calculation = 0, view but do not print

  • March 16, 2017
  • 2 replies
  • 281 views

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 has been closed for replies.

2 replies

JR Boulay
Community Expert
Community Expert
March 17, 2017

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;

Acrobate du PDF, InDesigner et Photoshopographe
MinusZero
Participating Frequently
March 17, 2017

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.