I'm trying to clear a People Picker field when a choice field before it changes. I have looked through the forum and know that I have to use "NF.PeoplePickerAPI" to do this with JS but I get through the error when I use the form in "preview" mode.
This is the code:
NWF$(document).ready(function () {
NWF.FormFiller.Events.RegisterAfterReady(function () {
});
NWF$('#'+ARCApproval).change(function() {ARCApprovalChanged();});
});
function ARCApprovalChanged() {
NWF$('#'+ARC1).val('');
NWF$('#'+ARC2).val('');
NWF$('#'+NotARC).find("input:radiotvalue='Executive Manager(EM)']").attr("checked",false);
NWF$('#'+NotARC).find("input:radio'value='ETDR']").attr("checked",false);
var EM1PP = new NF.PeoplePickerAPI ('#'+EM1);
EM1PP.clear();
NWF$('#'+EM2).val('');
var ETDR1PP = new NF.PeoplePickerAPI ('#'+ETDR1);
ETDR1PP.clear();
NWF$('#'+ETDR2).val('');
NWF$('#'+ETDR3).val('');
}
This is the error:
Any insight would be appreciated.