Expand my Community achievements bar.

Expand Hidden Subforms to print?

Avatar

Level 2

I have a form where there are subforms hidden until a box is checked.  Is there a way for the user to print out the entire form before they answer any questions?  Do I just need to write a code and put a button in for printing?  I'm looking for a way to expand all the questions without clicking any checkboxes.  (Hopefully this explains what I'm looking for.)

Thanks in advance.

Rose.

3 Replies

Avatar

Level 10

Write code in the prePrint event of the Print button on your form to set the presence property of all the subforms to "visible";

Thanks

Srini

Avatar

Level 2

I'm newer to coding.  Is there something that can change all subforms at once?  Or do I need to write a line of code for each subform?

Avatar

Level 10

Use the below code to loop thru all the pages in your PDF and then all the subforms in each page and set their presence to visible..

try{  


        // Get the Subform containers from each page.
        for (var i = 0; i < xfa.layout.absPageCount(); i++) {


            var oSubforms = xfa.layout.pageContent(i, "subform",0);
            var nodesLength = oSubforms.length;


            // Set the access type.
            for (var j = 0; j < nodesLength; j++) {
                var oItem = oSubforms.item(j);
                     oItem.presence = "visible";
            }
        }
    }catch(e){
        app.alert("Error in enabling the Subforms  - " + e);
    }

Let me know if this helps..

Thanks

Srini