


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!
Views
Replies
Sign in to like this content
Total Likes
Hi,
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(oNode.nodes.item(i));
}
}
changeFields(xfa.form); // call the function
The real challenge will be to find out, which fields to hide again after printing the form.
Views
Replies
Sign in to like this content
Total Likes
Hi,
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(oNode.nodes.item(i));
}
}
changeFields(xfa.form); // call the function
The real challenge will be to find out, which fields to hide again after printing the form.
Views
Replies
Sign in to like this content
Total Likes