Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Trying to hide text fields that the user has left blank when printing

Not applicable
Hi,



I'm trying to hide optional text fields that the user has left blank when printing a document.



I've tried the following JavaScript on the Preprint option to no avail:



if {this.rawValue == " "} this.presence = "hidden";



if {this.rawValue == Null} this.presence = "hidden";



if {this.rawValue == Null()} this.presence = "hidden";



Any ideas?



Thanks!



Andi
6 Replies
Not applicable
Hello,



try this. Maybe it's the solution:



if (this.rawValue == "")

{field.presence = "hidden"};
Not applicable
That didn't work either. Any other ideas?



Thanks!



Andi
pguerett
Level 10
Level 10
Instead of making the pressence of the field hidden, try setting the relevant property to -print (this says that you do not want the field on when you print). Don't forget to set it back (+print) on the post print event.
Not applicable
The problem is that I want to print the field if the user has placed a value in it.



I want to hide the field if the user has left the field blank to save on space on the page.
Not applicable
in your script your syntax looks wrong. It should be:



if (this.rawValue == null) { this.presence = "hidden"}



The other problem is that you say if (this.rawValue == " ") the problem with this is that there is a blank char there so it will prove false. You should change it to read: if (this.rawValue == "" )



I hope that helps
Ryan_Lunka
Level 5
Level 5
I've had a lot of problems with the Pre-Print event. I have a script where I have to reverse all of my colors on the dark form I am creating to print mostly white. I couldn't get it to work in Pre-Print. Are you using a print button on the form? If you are try calling the script to make the fields hidden in the button click, before the script to execute the print.



Also, when you use the term "null", be sure that it is all lowercase. I don't think JavaScript will recognize "Null". It has to be "null".