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

Update repeating field dropdown (all rows) control using javascript

Jump to solution

Hi,

dropdown in the repeating field gets populated via javascript when the page loads , but how do we get the same script update the newly created dropdown when we click on "Add new row" ?

I want to populate all the rows with the same dropdown data but for now only the first dropdown in the repeating control gets populated. I did try to call the JS Function on button click to run the below code but it only appends the data to the first row only .

Rep_ddl_T2_Code is javascript id for dropdown.

Extract of the code ( external include )

function(xmlDoc)

{

 parser = new DOMParser();
 xmlDoc = parser.parseFromString(xml,"text/xml");
 var dat = xmlDoc.getElementsByTagName("Title");
   for (i = 0; i < dat.length; i++) {
    option = '<option value="' + dat.childNodes[0].nodeValue + '">' + dat.childNodes[0].nodeValue + '</option>';
       NWF$('#'+ Rep_ddl_T2_Code).find('option').end().append(option)

}

}

Labels: (2)
Tags (1)
0 Kudos
Reply
3 Replies
Workflow Hero

Re: Update repeating field dropdown (all rows) control using javascript

Jump to solution

To access controls inside Repeating section, one should add CSS classname to the control instead of using the ID of the control and access it by the CSS classname as shown below:

NWF$(".css-class-of-your-repeating-section .nf-repeater-row:last .css-class-of-your-dropdown-list select").append(options);

Check this: https://community.nintex.com/message/22589?commentID=22589#comment-22589   

Reply
Workflow Hero

Re: Update repeating field dropdown (all rows) control using javascript

Jump to solution

Thanks Chaitra !! Works like magic. thank you so much for pointing in the right direction.

0 Kudos
Reply
Workflow Hero

Re: Update repeating field dropdown (all rows) control using javascript

Jump to solution

And don't make my mistake using the Control CSS. It definitely should be the CSS Class where you have to add the selector CSS class name.

0 Kudos
Reply