![](/img/trans.png)
[英]How can I add values from textfield when i press the button with not having all of the values
[英]Using LiveCycle How can I create and populate a new row in a table with values from other fields with a button press?
這是我當前的代碼,到目前為止,該按鈕將在表中創建新行,並且將重置字段(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>
嘗試以下代碼:
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。
順便說一句 在腳本中引用對象時,可以使用它的SOM表達式failuretable.Table1._FailureRow
代替this.resolveNode('failuretable.Table1._FailureRow')
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.