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

Userlevel 5
Badge +14

does it have to be separate button? couldn't you use OOTB provided 'Add new row' link?

when new repeater row is being added there are generated Before-/After-RepeaterRowAdded events for which you could write your own handler and copy value from previous row.

see  

Badge +3

I would try this option with events!

For another button, I don't know, maybe its  not necessary to add a new button. 

Badge

Can some give an example?  I see the JavaScript  events before/ after filler.  What info would go into it to trigger the copy or duplication?

Userlevel 5
Badge +14

do you mean example of how to use RegisterRepeaterRowAdded event?

see https://community.nintex.com/message/45769-re-custom-validation-function-not-fired-on-repeating-section?commentID=45769#… 

Userlevel 5
Badge +14

Hi Mantas Šedys‌, were you able to resolve this?

Badge

I want to copy information from one field to another in repeating section row.  What would the function be in nintex?

I am trying to use this to get the output.

function copy_data(val){ var a = document.getElementById(val.id).value  document.getElementById("copy_to").value=a}

207140_pastedImage_1.png

Userlevel 5
Badge +14

then you might want to look on these threads

Can you duplicate a repeating section in the same form? 

 

both of them show a way how to copy value among controls in repeating section(s)

Badge +3

Hi Marian,

this project was side-job, so it's still necessary and i'm planning to do it in November! 
Still on focus! happy.png

Badge +3

Marian Hatala‌, Alexander Hunt

I'm in progress with this task.

Now I'm using Nintex Forms - Numbering a Repeating Section - Vadim Tabakman  Vadim example, just add some functionality by my needs.

I copy the first textbox in repeatingSection and add it's value to the new textbox:

In text box "Client ID JavaScript variable name" is set pirm.

Code:
var x = document.getElementByID(pirm).value;

and after if()

NWF$(repeaterRow).find('.empty').find('input').val(x);

Maybe You have ideas, how to detect last row and get textbox value from it?
Maybe with Row number?
Looking forward to hear news from You all happy.png 

adding full code:

Repeating Code · GitHub 

Badge +3

‌,

You are good in repeating section explanation. Could You help us? happy.png 

Userlevel 5
Badge +14

you can read textbox control's value from last repeater row as follows.

note to use class selector instead of javascript variable.

NWF$('.vtMyRepeatingSection .nf-repeater-row:not(.nf-repeater-row-hidden):last .primClass input').val()

reg. numbering repeater rows, note Vadim's blog is from 2015.

you need not to calculate rownumber on your own anymore, there already exist  currentRowNumber() runtime function.

Badge +3

I would try this option!

I'm stuck in SP2010, so using old methods confused.png

Badge +3

getting a message (with alert() ) - undinefined..

Code snippet: RepeatingRow · GitHub 

Userlevel 5
Badge +14

do you refer to currentRowNumber() function?

by the documentation it should be available in Forms2010 as well - https://help.nintex.com/en-US/nintex2010/help/#Forms/RootCategory/Designer/Nintex.Forms.RuntimeFunctions.htm%3FTocPath%3… 

Badge +3

Found this function!
definitely I will try it!

Userlevel 5
Badge +14

try to remove selectors one by one from the end to determine where it starts failing.

like

NWF$('.vtMyRepeatingSection .nf-repeater-row:not(.nf-repeater-row-hidden):last .primClass input').length

NWF$('.vtMyRepeatingSection .nf-repeater-row:not(.nf-repeater-row-hidden):last .primClass').length

NWF$('.vtMyRepeatingSection .nf-repeater-row:not(.nf-repeater-row-hidden):last').length

...

Badge +3

You're pro, Marian Hatalahappy.png

Tested and only with the last one 

NWF$('.vtMyRepeatingSection .nf-repeater-row:not(.nf-repeater-row-hidden):last').length

get result = 1; 

But it should return much more. 

Userlevel 5
Badge +14

but you have just one single last row, haven't you? happy.png

that means it can not find any any control with "primClass" "CSS class".

a typo?

can you post configuration of 'prim' text control?

Badge +3

Badge +3

Now trying with line : 

alert(NWF$('.RP .nf-repeater-row:not(.nf-repeater-row-hidden):last .prim input').length);

get asnwer = 2

Badge +3

Optimize my code, so its much more smaller, but still get answer 1.. 

Badge +3

get answer = 2*

Userlevel 5
Badge +14

Answer 2 is correct.

Replace length with val() and you should get the value

Badge +3

Get empty value..

Userlevel 5
Badge +9

Can you try with the following line :

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

Reply