AnsweredAssumed Answered

Dropdown Is Empty After Adding New Row

Question asked by superigno on Jun 7, 2018

Newbie here. So here's my problem:

 

Basically I have a repeating section, with a dropdown list on the first column (Col A)

 

The value of the dropdown is filled using webservice being retrieved using javascript:

 

 

 

NWF.FormFiller.Events.RegisterAfterReady(function() {

   .....

   getProducts(NWF$('#'+foo));

   .....

 

});

 

 

 

function getList(jsClientId) {
NWF$.ajax({
method: "GET",
url: "<web service url>",
success: function(data) {
var list_sample = data['list_sample '];
var select = "<option>Please select a value</option>";

for (let i = 0; i < length; i++) {
   select += "<option value=" + list_sample [i].id+ ">" + list_sample [i].name+ "</option>";
}
jsClientId.html(select);
},
error: function(data) {
   console.log("error");
}
});
}

What happens is, on the first row, the dropdown lists the values completely. BUT after clicking "Add New Row", the succeeding dropdowns from the other rows are empty. Why is that?

 

 

Click Add New Row:

 

 

Click Add New Row again:

 

Outcomes