2 Replies Latest reply on Sep 9, 2013 10:54 AM by Gene--O

    Filling a form based on a Table


      Good Afternoon,


      I have a 2 page form that I am creating.


      The first page is a timesheet. It has 2 fields of interest which are both repeated in a table with 15 rows:

      The first field is named "Date1". This field contains the day of the month (ex. 1, 2, 3...)


      The second field is named "amIN". In this field, the employee will enter the time they started their shift. (ex. 08:00)



      The second page will have fields where the employee will enter their activity for that particular day. These entries will contained 15 in fields named "DayofMonth[*]. Specifically, I want a script for a field on the second page, called "Dayof Month1" to populate the value of "Date1" ONLY if "amIN" is not null.


      If Row1.amIN is null, then I want the script to look to Row2.amIN. If it is null, then I want it to look to Row3.amIN, etc. I want it to scan each row for the first amIN that contains a value, and populate the corresponding value from the "Date" field into "DayofMonth1". Then I want it to continue to populate from the next amIN that has a value into "DayofMonth2", etc.


      I am probably not explaining this very well, but I hope someone can make sense of it.





        • 1. Re: Filling a form based on a Table
          mrfale67 Level 2

          My table is on page 3. Fields to be filled in are on page 4.


          In page 4 calculate event:



          var myVal;

          var count = form1.pag3.sub3.Table3.Row1.all;

          for (var i=0; i<count.length; i++) {

            myVal = xfa.resolveNode("form1.pag3.sub3.Table3.Row1["+i+"].amIN").rawValue;

            if (myVal) {

            myVal = xfa.resolveNode("form1.pag3.sub3.Table3.Row1["+i+"].Date1").rawValue;

            fillIn(i, myVal);





          function fillIn(i, myVal) {

            var myFldToSet;

            var count = form1.pag4.sub4.DayofMonth.all;

            for (var j=0; j<count.length; j++) {

            myFldToSet = xfa.resolveNode("form1.pag4.sub4.DayofMonth["+j+"]");

            if (j == i) {

            myFldToSet.rawValue = myVal;





          In page 3 validate event:




          it should work if you properly adapt names to your conventions.


          Let me know.

          • 2. Re: Filling a form based on a Table
            Gene--O Level 1

            thanks for the reply, I'll give it a shot!!!