Expand my Community achievements bar.

Copying and displaying user input value in repeatable table


Level 1

Hi everyone,

I'm working on a form that needs to copy a value the user has entered and display it in another field when the add row button is clicked in a repeatable table. To give you a quick idea of what this looks like, refer to the screen print below:


The user enters the Start Meter and End Meter Values, and the Qty Gallon fields are automatically calculated. As of now the user enters both the Start Meter (SM) and Ender Meter (EM) values in the first row. Here it is displayed as SM = 1,000 and EM = 2,000. In the exit event of the EM field, the SM field in the next row automatically prefills with that value. As you can see, the second row has 2,000 as the value.

This works because when the form is opened the three rows you can see here are already created. However, when the add row button is clicked, the new row is empty of values and does not prefill the SM field with the last EM value. If this problem was solved, I would be able to add a new row and the SM field would be populated with the value 4,000 (if we continue with the example provided).

The code I've been working on looks like this:

if (xfa.resolveNode("Row1[" + Usage._Row1.count-1 +"].em").rawValue >0) {

     xfa.resolveNode("Row1[" + Usage._Row1.count + "].sm").rawValue = xfa.resolveNode("Row1[" + Usage_Row1.count-1 +"].em").rawValue;


Anyone have any ideas? Thank you in advance!

1 Reply


Level 10

You need to get the index (instance number) of the row you are trying to access.

Try this on the layout:ready event of your sm field:

//get index of current row

var i = this.parent.index;

//if current index is greater than zero pull value from previous row

if (i > 0) {

          this.rawValue = this.resolveNode("Row1[" + (i - 1) + "].em").rawValue;