I have a form that has a question and answer section in a repeatable subform such that the response to each question is directly below the question. The original instance is 1 but an unlimited number of instances can be added. Person 1 completes most of the form and adds the instances based on the number of questions they have and sends the form to Person 2 to answer the questions and sign the form digitally.
Through the action feature of Designer I added a lock button for Person 1 to set all the fields they edited to Read Only and to disable and hide the add and delete buttons that control the instances. The action wizard will only lock the first instance of the repeatable subform not any other instances added on.
I resorted to creating my own scripting to have the lock button attempt to lock all the fields in the instances that are entered by Person 1 but it isn't working properly.
The Subform "RFI" has the repeating subform within it called "Item", Add and Delete buttons create new Item subforms within "RFI"
- main subform: "topmostSubform.Page1.RFI"
Within "Item" there are the following objects.
- Item No - numeric field - Entered by Person 1 - to be readOnly
-RFI - Text field - Entered by Person 1 - to be readOnly
-Resposne - Fixed Text
-SiteResponse - Text field - Entered by Person 2 - To be left open.
Since we don't know the numbers that will be at the end of "Item", I am not sure how to tell the software to lock only 2 of the 4 fields within the repeating subform.
CURRENT SCRIPTING:
var oNodes = topmostSubform.Page1.RFI;
var nNodesLength = oNodes.length;
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount ++ ){
if (oNodes.item(nNodeCount).item == "field"){
oNodes.item(nNodeCount).access = "readOnly";
}
}
Things I have found online but don't know how to put together to get what I want :
// Invoke the Instance Manager to add and remove the comments subform.
if (_comments.count == 0) {// The count property specifies the current number // of instances instantiated. _comments.setInstances(1); // Add the comments subform. this.resolveNode("caption.value.#text").value = "Clear Comments"; Change the button's caption. } else { _comments.setInstances(0); // Remove the comments subform. this.resolveNode("caption.value.#text").value = "Add Comments"; Change the button's caption. } // //
Subform.instanceManager.removeInstance(subform.instanceManager.count - 1);
// Access fields using partial object names.
// Get the field containers from each page.
for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++) {
var oFields = xfa.layout.pageContent(nPageCount, "field");
var nNodesLength = oFields.length;
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {
if (oFields.item(nNodeCount).name.substr(0,2) == "Te") {
xfa.host.messageBox(oFields.item(nNodeCount).name);
} } }
var oNodes = topmostSubform.Page1.RFI;
var nNodesLength = oNodes.length;
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount ++ ){
if (oNodes.item(nNodeCount).item == "field"){
oNodes.item(nNodeCount).access = "readOnly";
}
}
if (Subform3.index != 0) {
//nIndexFrom and nIndex To store the before and after index values to use with the moveInstance method.
var nIndexFrom = Subform3.index;
var nIndexTo = Subform3.index - 1;
Subform3.instanceManager.moveInstance(nIndexFrom, nIndexTo);
}
else {
xfa.host.messageBox("The current item cannot be moved because it is the
first instance in the list.", "Combining Instance Manager Concepts", 1);
}
You can also write this script by using the underscore (_) notation to reference the properties and methods of the ins
I am hoping this member @radzmar can help because a lot of questions I posed in google he answered previously....