Livecycle Designer:JS:按名称查找所有元素

时间:2014-08-12 11:17:52

标签: javascript adobe livecycle-designer

我在Adobe Livecycle Designer中有一个文档,其中有多个文本字段名为" Jahr1"。它们分散在整个文件中。

现在我想更改所有这些字段的值。为此,我需要找到名称为" Jahr1"的所有文本字段。我试过这样:

var nodes = xfa.resolveNodes("Jahr1[*]");

也是这样的:

var nodes = xfa.resolveNodes("Jahr1");

nodes仍为空。

有什么想法吗?

1 个答案:

答案 0 :(得分:2)

 form1.Subform2.Jahr1[0]::initialize - (JavaScript, client)

    // Access a field property using a field name. 
    // Change the field properties of a specific subform. 
    // Use the [] operator to access an object's property.

    // First, get the subform nodes. 
    var oNodes = Subform2.nodes; 
    var nNodesLength = oNodes.length; 

    // Loop through the subform's nodes and look for fields. 
    for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount ++) { 

        // Set the field property. 
        if (oNodes.item(nNodeCount).name.substr(0,5) == "Jahr1") { 

          oNodes.item(nNodeCount).rawValue = nNodeCount;
        } 
    }