Button that hides all empty fields

johnnyp32387969

29-10-2018

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?

Accepted Solutions (1)

Accepted Solutions (1)

radzmar

MVP

29-10-2018

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

Answers (5)

Answers (5)

johnnyp32387969

29-10-2018

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.