cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

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
4 Replies
Workflow Hero

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.

Accept as Solution Reply
Workflow Hero

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);
            });
});

Accept as Solution Reply
Workflow Hero

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
Accept as Solution Reply
Workflow Hero

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
Accept as Solution Reply