Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Subform Instance Control: Add problem

Avatar

Level 1

Using the built in script (LiveCycle 8.2.1) to add a pair of rows to a table the script fails after one instance is added. Identical scripts just above this one execute properly.

var sSubformSOM = "xfa.form.IEP_Form.FuturePlan.frm_SDI.frm_RelServ";     // Button is not within the form to be duplicated
var bCalc = true;                 // Example: var bCalc = false;
var message = "You have reached the maximum number of items allowed.";
// DO NOT MODIFY THE CODE BEYOND THIS POINT - 8.2.1.3144.1.471865.466429 - Subform_Instance_Controls_Add.xfo
// Build the SOM expression of the Instance Manager using the 'underscore' syntax.
var oSubform = xfa.resolveNode(sSubformSOM);         // Evaluate the SOM expression.
var sParentSOM = oSubform.parent.somExpression;      // Get the parent SOM expression.
var sManagerSOM = sParentSOM + "._" + oSubform.name; // Build the SOM expression of the Instance Manager.
var oManager = xfa.resolveNode(sManagerSOM);         // Evaluate the SOM expression.
var nMaxCount = oManager.occur.max;     // Get the maximum number of subform occurrences allowed.
var nSubCount = oManager.count;            // Get the current number of instances.
// Proceed if the maximum number of subform occurrences has not been reached.
if ((nMaxCount == "-1") || (nSubCount < nMaxCount)) {
    // Invoke the Instance Manager.
    var oNewInstance = oManager.addInstance(1);
    // Fire the form calculations.
    if (bCalc == true) {
        // Execute all the form calculations.
        xfa.form.recalculate(1);    }
} else {
    xfa.host.messageBox(message,"Add Item", 3);
}
// END OF DO NOT MODIFY

oManager in debugger "has no properties". As an app.alert(oManager) the first time thru (when it works) is an object. Subsequently it is null.

I could understand if it never worked.(?)

0 Replies