使用LiveCycle如何使用按钮按钮在其他字段中创建并填充表中的新行?
问题描述:
这是我目前的代码,到目前为止按钮将在表中创建一个新行,它将重置字段(AdditionalComments,CellLocation和FailureSelection,这些都是文本字段),但它不会允许我填充原来FailureRow或创建FailureRow的新实例:使用LiveCycle如何使用按钮按钮在其他字段中创建并填充表中的新行?
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>
答
试试下面的代码:
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;
记得有一个正确的名称来代替CELL_NAME。
btw。当您在脚本中引用对象时,您可以使用它的SOM表达式failuretable.Table1._FailureRow
而不是this.resolveNode('failuretable.Table1._FailureRow')
。
真棒工作!非常感谢。但是,现在将字段重置为原始状态的最后几行代码不再有效,为什么?还要感谢SOM表达式上的指针! – user2196209 2013-03-26 17:36:44
NVMD我调整了一下,它工作!非常感谢! – user2196209 2013-03-26 18:00:57
好的,所以我在表单中更新了很多,需要一个更大的表格,我重复使用表格名称,但现在旧的按钮不起作用,并且具有相同代码的新的按钮也不会起作用。这里是我有:form1.failuretable.Button1 :: click - (JavaScript,客户端) var newRow = this.resolveNode'failuretable.failuretable._FailureInstance')。addInstance(); newRow.Comments.rawValue = form1.AdditionalComments.rawValue; \t newRow.Location.rawValue = form1.CellLocation.rawValue; \t newRow.FailureCode.rawValue = form1.FailureSelection.rawValue; 任何想法?谢谢! – user2196209 2013-04-30 22:40:41