Skip navigation
Currently Being Moderated

Hide Specific Table Rows and Subforms based on CheckBox Value

Sep 7, 2012 10:44 AM

Attempting to make a document as follows:

 

OK, I almost have this working - what is wrong with my code?

 

******************

form1.page1.printingSF.PrintButton2::click - (JavaScript, client)

 

var startTime = new Date(); // to measure performance

 

page1.presence = "hidden";

page1hidden.presence = "visible";

 

var j = 0;

 

for (var i=0; i<=15; i++)

{

    var oRow = xfa.resolveNode("Table1.Row1[" + i + "]");

    if(oRow.checkcol.rawValue != "0")

    {

        page1hidden.Table1._Row1.addInstance(true);

        var oHidden = xfa.resolveNode("page1hidden.Table1.Row1[" + j + "]");

        j += 1;

        oHidden.checkcol.rawValue = oRow.checkcol.rawValue;

        oHidden.txtitem.rawValue = oRow.txtitem.rawValue;

        oHidden.fieldcol1.rawValue = oRow.fieldcol1.rawValue;

        oHidden.fieldcol2.rawValue = oRow.fieldcol2.rawValue;

    }

}

 

var endTime = new Date();

page1hidden.header.ms.rawValue = endTime.getTime() - startTime.getTime();

 

xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 1, 0, 0, 0);

 

form1.page1.printingSF.PrintButton2::postPrint - (JavaScript, client)

 

page1.presence = "visible";

page1hidden.presence = "hidden";

 

var oNodes = page1hidden.Table1._Row1.count -1;

 

for (var j=0; j<=oNodes; j++)

{

    xfa.resolveNode("page1hidden.Table1.Row1[0]").instanceManager.removeI nstance(0);

 
Replies
  • Currently Being Moderated
    Sep 8, 2012 9:35 PM   in reply to Liz Tapanes

    Hi,

     

    You probably need to publish your form so we can have a look, though the last line looks a bit odd, is the space in the "removeI nstance" method name just from pasting the code into this forum?

     

    Regards

     

    Bruce

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 13, 2012 4:52 AM   in reply to Liz Tapanes

    Hi,

     

    Since you have a reference to the row, you can refer to the next row using a SOM expression with a relative index, so;

     

    
    for (var i=0; i<=23; i++)
    {
        var oRow = xfa.resolveNode("Table1.Row1[" + i + "]");
        if(oRow.checkcol.rawValue == "0")
        {
            oRow.presence = "hidden"; 
            var oNextRow = oRow.resolveNode("Row1[+1]");
            oNextRow.presence = "hidden"; 
        }
        break;
    }

     

    and then a similar thing on the postPrint

     

    Bruce

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points