Basic JavaScript Looping in Adobe LiveCycle Designer®


A HowTo video on using a JavaScript “for” loop to test and remove instances of repeatable table rows, based on user input.

For a basic understanding of “For” loop syntax, checkout w3schools reference page:  http://www.w3schools.com/js/js_loop_for.asp

Delete Button Code:
 var vRows = Table1._Row1.count-1;
 if(vRows==0){
     Table1._Row1.removeInstance(0);
   } 
 for(var i=vRows;i>=-1;i–){
 if(Table1.resolveNode(“Row1[” + i + “]”).Cell1.rawValue!==1){
     Table1._Row1.removeInstance(i);
  }
 }

Add Button Code:
 Table1._Row1.addInstance();

Leave a Reply

HTML Snippets Powered By : XYZScripts.com