2013-03-21 39 views
0

這是我目前的代碼,到目前爲止按鈕將在表中創建一個新行,它將重置字段(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> 

回答

0

試試下面的代碼:

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')

+0

真棒工作!非常感謝。但是,現在將字段重置爲原始狀態的最後幾行代碼不再有效,爲什麼?還要感謝SOM表達式上的指針! – user2196209 2013-03-26 17:36:44

+0

NVMD我調整了一下,它工作!非常感謝! – user2196209 2013-03-26 18:00:57

+0

好的,所以我在表單中更新了很多,需要一個更大的表格,我重複使用表格名稱,但現在舊的按鈕不起作用,並且具有相同代碼的新的按鈕也不會起作用。這裏是我有: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

相關問題