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...)
form1.subform[1].Table1[0].Row1.Date1
The second field is named "amIN". In this field, the employee will enter the time they started their shift. (ex. 08:00)
form1.subform[1].Table1[0].Row1.amIN
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.
thanks!!!
Gene-O
Views
Replies
Total Likes
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:
xfa.form.form1.pag4.execCalculate();
it should work if you properly adapt names to your conventions.
Let me know.
Views
Replies
Total Likes
thanks for the reply, I'll give it a shot!!!
Views
Replies
Total Likes