Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Javascript code new line

Avatar

Level 1

Ok, sorry for the question, it might have been answered before but need help... I am making a table in Livecycle with buttons for adding new rows. Have found the script for this, and it is working.    So now we need to be able to add a new line inbetween the other rows. This would be a row without columns with the same width of the table so the users of the form could seperate between different numbers when scrolling through the form...

The row is to be added with the click of a button...

And also when the users click the «new row» button, it will continue below this row.

Hope this is understandable.

1 Accepted Solution

Avatar

Correct answer by
Level 7

Note sure if this is what you were after.

I created a simple table with two rows, one row has 4 cols, has a button to show the second row and is visible. The second row has the cells merged and is hidden.

I have a button to create 'new rows' positioned outside the table. The trick is to wrap the table in a subform and repeat the subform (sfTable), NOT the table (Table1). So instead of creating new rows, you are actually creating whole new tables wrapped in a subform. The page also needs to be flowed.

1468088_pastedImage_0.png

1468089_pastedImage_1.png

form1.#subform[0].sfTable.Table1.Row1.btnShowRow::click - (JavaScript, client)

this.resolveNode("RowMerged").presence = "visible";

form1.#subform[0].btnNewRow::click - (JavaScript, client)

this.resolveNode('form1.#subform._sfTable').addInstance(1);

if (xfa.host.version < 8) {

xfa.form.recalculate(1);

}

What this does is this:-

You can keep adding new rows (subforms) and in each instance you can show (unhide) the single merged row if you wish. Note: I havent added a hide button.

1468090_pastedImage_5.png

View solution in original post

1 Reply

Avatar

Correct answer by
Level 7

Note sure if this is what you were after.

I created a simple table with two rows, one row has 4 cols, has a button to show the second row and is visible. The second row has the cells merged and is hidden.

I have a button to create 'new rows' positioned outside the table. The trick is to wrap the table in a subform and repeat the subform (sfTable), NOT the table (Table1). So instead of creating new rows, you are actually creating whole new tables wrapped in a subform. The page also needs to be flowed.

1468088_pastedImage_0.png

1468089_pastedImage_1.png

form1.#subform[0].sfTable.Table1.Row1.btnShowRow::click - (JavaScript, client)

this.resolveNode("RowMerged").presence = "visible";

form1.#subform[0].btnNewRow::click - (JavaScript, client)

this.resolveNode('form1.#subform._sfTable').addInstance(1);

if (xfa.host.version < 8) {

xfa.form.recalculate(1);

}

What this does is this:-

You can keep adding new rows (subforms) and in each instance you can show (unhide) the single merged row if you wish. Note: I havent added a hide button.

1468090_pastedImage_5.png