I have a repeatable row in a table that is defaulted to read only. If a certain value doesn't exist in the XML (populated != x), I want to make add / remove buttons visible and and make the text fields in the row and all subsequent instances Open.
when populated !=x:
This is the code:
if (xfa.host.name != "XFAPresentationAgent" && this.resolveNode("populated").rawValue != "x") {
oTargetField = this.resolveNode("#subform[2].tbl_people.person.name");
oTargetField.access = "open";
oTargetField = this.resolveNode("#subform[2].tbl_people.person.relationship");
oTargetField.access = "open";
oTargetField = this.resolveNode("#subform[2].tbl_people.person.age");
oTargetField.access = "open";
}
When I use this, it only enables the first row and none of the subsequent rows/instances.
Any assistance would be greatly appreciated!
-Jeff
Views
Replies
Total Likes
Hi DCS_JeffW,
I guess, you need to follow these steps:
1) You need to find the number of repeating rows first. Assuming that "people.person" is the repeating instance:
var countOfPPInstances = xfa.resolveNode("....people.person").instanceManager.count;
2) Modify your code as follws:
if (xfa.host.name != "XFAPresentationAgent" && this.resolveNode("populated").rawValue != "x")
{
for(var i=0;i<countOfPPInstances;i++)
{
xfa.resolveNode(“..people.person[“+i+”].name").access=”open”;
xfa.resolveNode(“..people.person[“+i+”].relationship").access=”open”;
xfa.resolveNode(“..people.person[“+i+”].age").access=”open”;
}
}
Let me know if this works. Alternatively, you can mail me your form @ kvdvijaykumar@gmail.com
Views
Replies
Total Likes
Suspect Attachment
I changed to:
var countOfPPInstances = xfa.resolveNode("tbl_people.person").instanceManager.count;
if (xfa.host.name != "XFAPresentationAgent" && this.resolveNode("populated").rawValue != "x")
{
for(var i=0;i<countOfPPInstances;i++)
{
xfa.resolveNode("tbl_people.person["i"].name").access="open";
xfa.resolveNode("tbl_people.person["i"].relationship").access="open";
xfa.resolveNode("tbl_people.person["i"].age").access="open";
}
}
And it works perfectly!
Thank you!!
-Jeff
Views
Replies
Total Likes