Highlighted

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

Avatar

04-09-2008

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

Replies

Highlighted

Avatar

04-09-2008

Hello,



try this. Maybe it's the solution:



if (this.rawValue == "")

{field.presence = "hidden"};
Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

05-09-2008

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.
Highlighted

Avatar

05-09-2008

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.
Highlighted

Avatar

06-09-2008

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
Highlighted

Avatar

Avatar

Ryan_Lunka

Avatar

Ryan_Lunka

Ryan_Lunka

08-09-2008

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".