Skip to main content
Participating Frequently
July 17, 2025
Question

How to make a form field with a border and background only print if that field has been filled in

  • July 17, 2025
  • 1 reply
  • 211 views

Hi everyone,

I'm having a bit of difficulty with form fields.

Basically I have some product labels, some of which require to show a "UN" number and some which don't.

The client wants to be able to add the UN number themselves to the products which need it, and if they don't need it then this field  including the background colour and the border should not print.

 

 

The UN number, if it shows, needs to appear in an orange box with a black border. So if they fill in this field when they print it out it will look like this:

 


So far I have done all of the above and it is fine and works.

The problem is that if the field is NOT filled in because it has been purposely left blank I want it to not print at all so it looks like this:

 

But it doesn't. It prints like this:

 


How do I make the box NOT print if the form field remains empty?

Thanks in advance for any help.
Richard

1 reply

PDF Automation Station
Community Expert
Community Expert
July 17, 2025

Enter the following custom calculation script in the field:

if(event.value)
{event.target.display=display.visible}
else
{event.target.display=display.noPrint}
Participating Frequently
July 18, 2025

Sorry, that doesn't work. The blank orange box with the black border still appears on the printed file the same as before.

Nesa Nurani
Community Expert
Community Expert
July 18, 2025

Where did you place the script?

If you can't make it work, please share the file with us.