cancel
Showing results for 
Search instead for 
Did you mean: 
sammybusse
Nintex Newbie

Nintex Forms - prepopulate repeating section

Hi Guys, I have the challenge to prepopulate a repeating section.

The purpose of my repeating section is a Task list.

I have a second list where the Default responsibility of a Task is defined.

It would be perfect if I could prepopulate this list with some JavaScript or something else.

I also Need the possibility to add more rows or change the repsonsible Person of the task.

Do you have any suggestions to do this?

Repeating section

Labels: (1)
Tags (1)
0 Kudos
Reply
5 Replies
jpmhuls
Nintex Newbie

Re: Nintex Forms - prepopulate repaeting section

Hi Samuel‌,

This should indeed possible. Although in the end I didn't use it, I did some research and found several posts in this community:

Hopefully the above will get you going.

Reply
sammybusse
Nintex Newbie

Re: Nintex Forms - prepopulate repaeting section

I managed to fill the first line of my repeating section

 NWF$(document).ready(function()
 {  

NWF$(".ClassText:last input").val('My first Task');

NWF$(".rsClass a.ms-addnew").click();
 });

my next step to set the lookup field within the repating section and identify a specific row in repeating section.

I will use someting like:

NWF$(function() {
     NWF$('#'+ var_ListLookup).on('change', function()
        {
          setTimeout(function() {
               NWF$('#'+ var_responisble).val(NWF$('#'+ var_responsible).val());

          }, 2000);
            });
});

Reply
sammybusse
Nintex Newbie

Re: Nintex Forms - prepopulate repeating section

I managed to prefill my repeating section with part of these lines:
NWF$(".rsClassTPE .nf-repeater-row:last .ClassText:last input").val(item.Title);
NWF$(".rsClassTPE .nf-repeater-row:last .ClassPerson select").val(item.Mitarbeiter.ID);

The first one works and is succesfully saved.

The second one is a lookup field (Dropdown) which is filled but not saved when the form is submitted.

0 Kudos
Reply
jpmhuls
Nintex Newbie

Re: Nintex Forms - prepopulate repeating section

My experience is that a list lookup control needs 2 values (the ID and the display value). Here's a snippet I used before (IC is the JS control ID set in the control's Advanced Settings):

   var icSelectElement = NWF$("#" + IC).parent().find('select.nf-client-control');

   var icSelectId;

   if (icSelectElement && (icSelectElement.length == 1)) {   // Try to get the proper Select element generically

     icSelectId = NWF$("#" + IC).parent().find('select.nf-client-control')[0].id;

   } else { // Get proper Select element based on id

     icSelectId = IC.replace('_hid','');

   }

   NWF$("#" + icSelectId + " option:contains(" + selectedItem.get_item('IndustryCluster').get_lookupValue() +")").attr("selected", true); // Set selected option in Select element

   NWF$("#" + IC).val(selectedItem.get_item('IndustryCluster').get_lookupId() + ';#' + selectedItem.get_item('IndustryCluster').get_lookupValue()); // Set selected item string value (id;#textvalue) in Input element

The List Lookup control requires the combi <id>;#<display value>

NB: selectedItem is a query result from which metadata needs to be copied.

0 Kudos
Reply
dottie
Nintex Newbie

Re: Nintex Forms - prepopulate repeating section

Hi,

I know you wrote this about a year ago, and I think it fits with my issue. I've a multi-select checkbox, that once selected needs to be added to a field in a repeating table.

 

example: the multi-select box displays a list of manufacturing plants. The user selects Reno, Chicago, Nashville. The repeating section has several controls, one of the controls is a textbox named "Plants". If the user selects 3 plants from the multi-select box, I want 3 repeating section items to be displayed with the plants control pre-filled by what they selcted in the multi-select box. one plant per item.

I've found a lot of Javascript, and yours seems to be the closest. I need a little guidance, for the most part I stay out of the box, this may be very simple, any help is appreciated.

 

rpt1.pngrpt2.png

Thank you,

Dottie

0 Kudos
Reply