Easy way to make all fields visible when printed



Good morning!

I have a form which requires some questions to be answered depending on the previous answer.  If it is not needed, the next question stays hidden.  BUT then we realised, if someone decides to print out the form to then fill it out, unfortunately the hidden fields obviously do not print.  I have been using the PrePrint event and using the code

this.presence = "visible";

into each field.

I was just wondering if there was an easier or a bulk way to set "all" Hidden fields to visible IF the form is printed?

Many thanks!

Accepted Solutions (1)

Accepted Solutions (1)





a very simple way is a recursive function like this one. It finds all fields in the form that aren't visible and changes them to be visible:

function changeFields (oNode) { 

    if (oNode.className === "field") { 

        if (oNode.presence !== "visible") { 

            oNode.presence = "visible"



    for (var i = 0; i < oNode.nodes.length; i += 1) { 




changeFields(xfa.form); // call the function

The real challenge will be to find out, which fields to hide again after printing the form.

Answers (0)