I am currently working on an order form that has multiple items, each in their own sub form. I am using the following script in the layout:ready function on my total box. The problem I am having is it is only adding up the totals from the first page of the form, and not recognizing the totals from the second page of the form. any help would be great, thanks!
var
fields = xfa.layout.pageContent(0 , "field", 0);
var
total = 0;
for
(var i=0; i <= fields.length-1; i++) {
if
(fields.item(i).name == "p1") {
total
= total + fields.item(i).rawValue;
}
}
this.rawValue
= total;
Thanks,Aaron
Solved! Go to Solution.
Views
Replies
Total Likes
You can try the following code and let me know if you still have issues..
var total = 0;
// Get the field containers from each page.
for (var i = 0; i < xfa.layout.absPageCount(); i++) {
var oFields = xfa.layout.pageContent(i, "field");
var nodesLength = oFields.length;
// Get fields in the selected page.
for (var j = 0; j < nodesLength; j++) {
var oItem = oFields.item(j);
if(oItem.name == "p1")
total = total + oItem.rawValue;
}
}
this.rawValue = total;
Thanks
Srini
Views
Replies
Total Likes
You can try the following code and let me know if you still have issues..
var total = 0;
// Get the field containers from each page.
for (var i = 0; i < xfa.layout.absPageCount(); i++) {
var oFields = xfa.layout.pageContent(i, "field");
var nodesLength = oFields.length;
// Get fields in the selected page.
for (var j = 0; j < nodesLength; j++) {
var oItem = oFields.item(j);
if(oItem.name == "p1")
total = total + oItem.rawValue;
}
}
this.rawValue = total;
Thanks
Srini
Views
Replies
Total Likes
Thanks Srini, that worked perfectly!
Aaron
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies