Nintex Forms - prepopulate repeating section

  • 20 March 2018
  • 5 replies
  • 16 views

Badge +1

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


5 replies

Userlevel 2
Badge +11

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.

Badge +1

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

Badge +1

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.

Userlevel 2
Badge +11

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.

Badge +4

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.

 

3073i6D51F3835D0D3B5C.png3072iE11B7CDB22A0873F.png

Thank you,

Dottie

Reply