I am using the below script to get the number of pages where subform spans
xfa.layout.pageSpan(subform);
but it is giving number of pages where first instance of subform spans.
I have to get the number of pages where current instance of subform spans.
thanks in advance.
Solved! Go to Solution.
Views
Replies
Total Likes
I think the problem is you're referencing th first instance of the subform and so getting always the number of pages it spans.
Given your subform is named "customer" than the code xfa.layout.pageSpan(customer) really means xfa.layout.pageSpan(customer[0]) which is the first instance. For repeated objects you'll need to address the desired instance. This can be done either direct or relative.
For the direct way you'll have to know the SOM expression of the addressed object in question. This means to use SOM expressions with accessors []. In difference to FormCalc you can't use those SOM expressions with accessors as argument in JavaScript because of the square brackets. That's why it's wrapped in a resolveNode() method as a string.
// Get the page span of the third instance of the object 'customer' under form1.page.
xfa.layout.pageSpan(form1.page.resolveNode("customer[2]")); // JavaScript
xfa.layout.pageSpan(form1.page.customer[2]); // FormCalc
If the script is executed for an object which resides within the object to be addressed, you can use use a relative expression starting from the current object. It's much easier, since you don't have to deal with complex SOM expressions.
xfa.layout.pageSpan(this.parent); // Get the page span of a subform that surrounds this fields
Views
Replies
Total Likes
I think the problem is you're referencing th first instance of the subform and so getting always the number of pages it spans.
Given your subform is named "customer" than the code xfa.layout.pageSpan(customer) really means xfa.layout.pageSpan(customer[0]) which is the first instance. For repeated objects you'll need to address the desired instance. This can be done either direct or relative.
For the direct way you'll have to know the SOM expression of the addressed object in question. This means to use SOM expressions with accessors []. In difference to FormCalc you can't use those SOM expressions with accessors as argument in JavaScript because of the square brackets. That's why it's wrapped in a resolveNode() method as a string.
// Get the page span of the third instance of the object 'customer' under form1.page.
xfa.layout.pageSpan(form1.page.resolveNode("customer[2]")); // JavaScript
xfa.layout.pageSpan(form1.page.customer[2]); // FormCalc
If the script is executed for an object which resides within the object to be addressed, you can use use a relative expression starting from the current object. It's much easier, since you don't have to deal with complex SOM expressions.
xfa.layout.pageSpan(this.parent); // Get the page span of a subform that surrounds this fields
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies