简体   繁体   English

使用LiveCycle如何通过按下按钮来使用其他字段中的值创建并填充表格中的新行?

[英]Using LiveCycle How can I create and populate a new row in a table with values from other fields with a button press?

Here is my current code, so far the button will create a new row in the table and it will reset the fields (AdditionalComments, CellLocation, and FailureSelection, which are all text fields), but it will not allow me to populate the original FailureRow or the new instance of FailureRow that is created: 这是我当前的代码,到目前为止,该按钮将在表中创建新行,并且将重置字段(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>

Try the following code: 尝试以下代码:

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;

Remember to replace CELL_NAME with a proper name. 请记住用适当的名称替换CELL_NAME。

btw. 顺便说一句 When you are referencing object in the script you can just use it's SOM expression failuretable.Table1._FailureRow instead of this.resolveNode('failuretable.Table1._FailureRow') . 在脚本中引用对象时,可以使用它的SOM表达式failuretable.Table1._FailureRow代替this.resolveNode('failuretable.Table1._FailureRow')

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

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