Java 使用LiveCycle,我如何使用其他字段的值在表中创建和填充新行?

Java 使用LiveCycle,我如何使用其他字段的值在表中创建和填充新行?,java,button,livecycle,Java,Button,Livecycle,这是我的当前代码,到目前为止,该按钮将在表中创建新行,并将重置字段(AdditionalComments、CellLocation和FailureSelection,它们都是文本字段),但它不允许我填充原始FailureRow或创建的FailureRow的新实例: field name="AddFailureButton" w="31.114mm" h="6mm"> event name="event__click" activity="click"

这是我的当前代码,到目前为止,该按钮将在表中创建新行,并将重置字段(AdditionalComments、CellLocation和FailureSelection,它们都是文本字段),但它不允许我填充原始FailureRow或创建的FailureRow的新实例:

field name="AddFailureButton" w="31.114mm" h="6mm">

        event name="event__click" activity="click"
           script contentType="application/x-javascript"
           xfa.host.messageBox("Failure Recorded, Please Continue Filling Out the Form Until All Failures Have Been Recorded.  Then Please Save and Submit the form.", "Continue/Save/Submit", 3);
           this.resolveNode('failuretable.Table1._FailureRow').addInstance(1);
           if (xfa.host.version < 8) {
           xfa.form.recalculate(1);
}

//****need to set values of current FailureRow to be equal to CellLocation, FailureSelection, and AdditionalComments, THEN clear the values as written below*****

           xfa.host.resetData("form1.page1.AdditionalComments");
           xfa.host.resetData("form1.page1.CellLocation");
           xfa.host.resetData("form1.page1.FailureSelection");
</script>
fieldname=“AddFailureButton”w=“31.114mm”h=“6mm”>
事件名称=“事件\单击”活动=“单击”
script contentType=“应用程序/x-javascript”
xfa.host.messageBox(“记录了故障,请继续填写表格,直到记录了所有故障。然后请保存并提交表格。”,“继续/保存/提交”,3);
此.resolveNode('failuretable.Table1.\u FailureRow')。addInstance(1);
如果(xfa.host.version 8){
xfa.表单.重新计算(1);
}
//****需要将当前FailureRow的值设置为等于CellLocation、FailureSelection和AdditionalComments,然后按照下面的说明清除这些值*****
xfa.host.resetData(“form1.page1.AdditionalComments”);
xfa.host.resetData(“form1.page1.CellLocation”);
xfa.host.resetData(“form1.page1.FailureSelection”);

请尝试以下代码:

var newRow = this.resolveNode('failuretable.Table1._FailureRow').addInstance(1);
newRow.CELL_NAME.rawValue = form1.page1.AdditionalComments.rawValue;
newRow.CELL_NAME.rawValue = form1.page1.CellLocation.rawValue;
newRow.CELL_NAME.rawValue = form1.page1.FailureSelection.rawValue;
记住用正确的名称替换单元格名称


顺便说一句,当您在脚本中引用对象时,您可以只使用它的SOM表达式
failuretable.Table1.\u FailureRow
而不是
this.resolveNode('failuretable.Table1.\u FailureRow')

太棒了!非常感谢。然而,现在将字段重置为原始状态的最后几行代码不再工作,你知道为什么吗?还感谢您在SOM表达式上的指针!NVMD我调整了一点,它正在工作!非常感谢!好的,所以我在表单中更新了很多,需要一个更大的表,我重用了表名,但是现在旧的按钮不起作用,使用相同代码的新按钮也不起作用。以下是我所拥有的:form1.failuretable.Button1::click-(JavaScript,客户端)var newRow=this.resolveNode'failuretable.failuretable.\u FailureInstance')。addInstance();newRow.Comments.rawValue=form1.AdditionalComments.rawValue;newRow.Location.rawValue=form1.CellLocation.rawValue;newRow.FailureCode.rawValue=form1.FailureSelection.rawValue;有什么想法吗??谢谢代码中有一些错误(例如,resolveNode中缺少左括号,表名重复)。您通过写入“重用表名”来实现什么您有两个同名的表吗?实际上,如果不看形式,就很难说出真正的问题是什么。