简体   繁体   English

相当于FormCalc的[*]的Adobe LiveCycle Designer JavaScript

[英]Adobe LiveCycle Designer JavaScript equivalent to FormCalc's [*]

I'm using LiveCycle Designer to build a dynamic form that is able to add and delete rows of a nested table and calculate the total of each row. 我正在使用LiveCycle Designer构建一个动态表单,该表单能够添加和删除嵌套表的行并计算每行的总数。 The calculation uses FormCalc and utilizes the [*] function to address all iterations of a row. 该计算使用FormCalc并利用[*]函数处理一行的所有迭代。 (eg. ...someThing.Row1[*] instead of ...someThing.Row[0] , ...someThing.Row[1] , etc.) (例如, ...someThing.Row1[*]代替...someThing.Row[0]...someThing.Row[1]等)

This works perfectly, but I'd also like to use Javascript to alter the background fills of certain text field cells on a button mouseUp. 这可以完美地工作,但我也想使用Javascript来更改按钮mouseUp上某些文本字段单元格的背景填充。 I can get it to work targeting specific cells, but I'm not sure what steps to take in Javascript to address all dynamic iterations of an element. 我可以使它针对特定的单元格工作,但是我不确定要在Javascript中采取什么步骤来解决元素的所有动态迭代。

For example, this JavaScript works but only targets single cells: 例如,此JavaScript有效,但仅针对单个单元格:

MainForm.roomTableSubform.roomTable.Row1.Table1.Row1.billWidth.fillColor = "0,0,0";

Logically, (as I understand) if using FormCalc, to target the duplicated rows, the code would simply be something to the effect of: 逻辑上(据我了解),如果使用FormCalc来定位重复的行,则该代码将仅具有以下效果:

MainForm.roomTableSubform.roomTable.Row1[*].Table1.Row1[*].billWidth.fillColor = "0,0,0";

This obviously does not work with Javascript. 这显然不适用于Javascript。 I've read what I can find about resolveNode and it seems this is the JavaScript solution. 我已经阅读了关于resolveNode ,这似乎是JavaScript解决方案。 I am just unsure of how to use it in context to target an undisclosed number of dynamically created elements. 我只是不确定如何在上下文中使用它来针对数量未公开的动态创建的元素。

I've enclosed the entire expression within resolveNode, started the expression with xfa.resolveNode("... , used the asterisk within resolveNode ( resolveNode("Row1[*]") ), stuck it right where the Row is ( Table1.resolveNode("Row1[*]").blah ) and every other arbitrary combination I could think of, to no avail. 我已经将整个表达式封装在resolveNode内,以xfa.resolveNode("...表达式,在resolveNode( resolveNode("Row1[*]") )中使用星号,并将其正确地粘贴在Row( Table1.resolveNode("Row1[*]").blah )和我能想到的所有其他任意组合都无济于事。

Any insight as to where I'm going wrong would be greatly appreciated. 任何关于我要去哪里的见解将不胜感激。 Thanks in advance. 提前致谢。

xfa.resolveNode() returns one node. xfa.resolveNode()返回一个节点。 You need to use xfa.resolveNodes() to return a collection of nodes using a SOM expression. 您需要使用xfa.resolveNodes()通过SOM表达式返回节点的集合。 And you can traverse the nodes with a loop. 您可以循环遍历节点。

var nodes = Table1.resolveNodes("Row1[*]");
var len = nodes.length;
for(var i = 0; i < len; i++){
    nodes.item(i).fillColor = "255,200,200";
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM