I have a form with multiple pages and subforms. I would like a button that would search the form for all empty fields, and then hide them. Is there a simple way of achieving this?
Solved! Go to Solution.
Views
Replies
Total Likes
You can do so with a recursive function.
function changeFields (oNode) {
if (oNode.className === "field") {
if (oNode.isNull) {
oNode.presence = "invisible";
}
}
for (var i = 0; i < oNode.nodes.length; i += 1) {
changeFields(oNode.nodes.item(i));
}
}
changeFields(xfa.form); // call the function
Views
Replies
Total Likes
You can do so with a recursive function.
function changeFields (oNode) {
if (oNode.className === "field") {
if (oNode.isNull) {
oNode.presence = "invisible";
}
}
for (var i = 0; i < oNode.nodes.length; i += 1) {
changeFields(oNode.nodes.item(i));
}
}
changeFields(xfa.form); // call the function
Views
Replies
Total Likes
Is this as simple as creating a button and applying the code in the "click" script?
Views
Replies
Total Likes
Indeed!
Views
Replies
Total Likes
It doesn't seem to be doing what I hoped. The button just thinks for a second and then nothing. Do you know what I might be doing wrong? Thanks for the quick reply's, much appreciated.
Views
Replies
Total Likes
There was a closing bracket missing in the script above. I corrected it, so try it again.
Views
Replies
Total Likes
Awesome code. I will add that to my database of code tutorials.
Views
Replies
Total Likes
Views
Likes
Replies