Join the Team Forms community

how to hide a component on the PDF if the input is empty

Updated 7 days ago

how can i hide the component in pdf if the value/input is empty

Marked as solution

UPDATE

There is now a "PDF Visibility" option available for all components. This option will allow you to select between visible, hidden and Hide if empty. So, to hide a component in the PDF if the input is empty you can simply tick the "Hide if empty" option.

View full solution
A
2 comments

To hide a component in the generated pdf only when it has no value you can use the advanced conditional feature to dynamically hide the component.


The instance.isHtmlRenderMode() function will return true for PDF rendering and the instance.getValue() function will return the value of the component. Combining this into a conditional expression will allow you to hide the component in the PDF if there is no response to it as shown below.


JavaScript
if(instance.isHtmlRenderMode() && !instance.getValue())
    show = false

UPDATE

There is now a "PDF Visibility" option available for all components. This option will allow you to select between visible, hidden and Hide if empty. So, to hide a component in the PDF if the input is empty you can simply tick the "Hide if empty" option.