Repeating section duplicate row


Badge +3

Hello all to my friends,

I'm looking for solution/tips/tricks for my task.

I need to do:

1) Add repeating section to form - check!

2) Add text-box in repeating section form - check!

3) Input value - check;

4) Create button, which duplicate text-box and create a new line with text-box with input value. ( shortly - duplicate previously text-box) - not check..

I tried example ->   - but this is not what I want :/ 

All minds/opinions/suggestion are welcome!


29 replies

Badge +3

Strange - if I used this .val in RegisterRepeaterRowAdding -  i'm getting the last entered value.

But if I used .val in RegisterRepeaterRowAdded  - i'm getting an empty value..

Userlevel 5
Badge +9

Actually that's not strange : when you add a new row in a repeating section, it adds a row at the end of the repeating section and this new row is empty. The javascript line of code is getting the value of the textbox which is in last line of the repeating section. So once the new line is added, the last line is empty...

You should use RegisterRepeaterRowAdded and the following lines of code :

var secondToLastLine = NWF$('.RP .nf-repeater-row:not(.nf-repeater-row-hidden):last").prev();

NWF$('.RP .nf-repeater-row:not(.nf-repeater-row-hidden):last input.prim').val(secondToLastLine.find('input.prim').val());

Badge +3

Ching Ching, we have a winner!
Thank you, ‌!

Big thanks to You, ‌! 

Huge respect!

Userlevel 5
Badge +9

I'm glad that you finally found a solution happy.png.

Please mark an answer as correct to let people know that this question has been resolved wink.png

Reply