Почему не работает код - Adobe LiveCycle Designer - JavaScript - PullRequest
0 голосов
/ 15 января 2019

У меня есть подчиненная форма, которая должна дублировать себя, когда я нажимаю кнопку. Этот код находится в событии нажатия кнопки. Это в Adobe Livecycle дизайнер - Javascipt. Почему это не работает? Это не было написано мной

var rd = frmO.caption.value.resolveNode("#text").value;;
if (frmO.rawValue == null) {
    app.alert("Mai intai trebuie sa completati campul: " + rd + "!");
    xfa.host.setFocus(frmO);
    xfa.host.openList(frmO);
} else {

    /*
    This button will insert one instance of the repeating subform or table row.

    bCalc: Flag - true if the new instance might be referenced by other 
    calculations, otherwise false.  
    message: The error message displayed.
    */
    var bCalc = true;
    var message = "Ați atins numărul maxim de elemente permise.";
    //var err = "Trebuie sa completati toate campurile randului inainte de 
    adauga un rand nou!";
    //if (prod.name.rawValue != null && prod.supr.rawValue != null && 
    prod.norma.rawValue != null && prod.normaRed.rawValue != null &&
        prod.venit.rawValue != null) {

    // DO NOT MODIFY THE CODE BEYOND THIS POINT - 10.0.2.20120224.1.869952.867557 - Subform_Instance_Controls_IRM.xfo.p2

    var oWrapper = this.parent.parent; // The outer subform built in to the 
    object, enclosing the button group.
    var oTargetSubform = oWrapper.parent; // The subform or table row the 
    controls are intended to manipulate.
    var oManager = oTargetSubform.instanceManager; // Get the instance manager.
    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);
        }

        // Move the new subform below the current one.
        var nIndexFrom = oNewInstance.index;
        var nIndexTo = oTargetSubform.index + 1;
        oManager.moveInstance(nIndexFrom, nIndexTo);
    } else {

        xfa.host.messageBox(message, "Insert Item", 3);
    }
    //}
    //else
    //app.alert(err);

    // END OF DO NOT MODIFY
}

Я бы хотел, чтобы подчиненная форма копировалась при нажатии кнопки.

...