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

Avatar

04-09-2008

Hello,



try this. Maybe it's the solution:



if (this.rawValue == "")

{field.presence = "hidden"};

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

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.

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.

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

Avatar

Avatar
Validate 1
Level 4
Ryan_Lunka
Level 4

Likes

11 likes

Total Posts

143 posts

Correct reply

11 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 4
Ryan_Lunka
Level 4

Likes

11 likes

Total Posts

143 posts

Correct reply

11 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
Ryan_Lunka
Level 4

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