I'm trying to figure out, how it's possible to use the PeoplePicker API multiple times. (Add a SP-User from a textfield into the people picker control in a repeating section.)
Following is a sample of my actual code:
function test(){
NWF.FormFiller.Events.RegisterAfterReady(function () {
var $row = NWF$(this);
var rownumb = NWF$('.rows input').val();
var collection = {};NWF$(".your-repeater .nf-repeater-row:not('.nf-repeater-row-hidden')").each(function (){
var $migrationfield = $row.find(".migrationfield input").val();
for(var i=0;i<rownumb;i++){
collection = new NF.PeoplePickerApi('#' +peoplepicker);
collection.search($migrationfield).done(function (data) {
collection.add(data[0]);
});
}
});
});
}
The problem it returns in the dev-mode is following:
Uncaught TypeError: cannot read property 'add' of undefined.
So I clearly see that the add method does not work, but why not? Any Suggestions?