AnsweredAssumed Answered

Update repeating field dropdown (all rows) control using javascript

Question asked by rumlukik on Apr 19, 2017
Latest reply on May 31, 2018 by jpmhuls

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[i].childNodes[0].nodeValue + '">' + dat[i].childNodes[0].nodeValue + '</option>';
       NWF$('#'+ Rep_ddl_T2_Code).find('option').end().append(option)

}

}

 

Outcomes