First I’d like to say I’ve only been working with NinTex workflows for about two weeks now between my other tasks, I’ve no Java/JavaScript programming knowledge, and I have yet to get a handle on how all of the Nintex/SharePoint pieces work together. I’ve created and published one Nintex form, list, and workflow and it seems to be working and sending notifications properly. The only problem I’m having with it is…
I have a JavaScript snippet (that I got from this forum) located in my Nintex Forms ‘Settings/Custom JavaScript’ that runs on form load and removes duplicates from lookup fields where I have ‘duplicates’ referenced in the form control’s ‘Control Settings – List Lookup/Formatting/Control CSS class’. The JavaScript function works great.
Here’s the script:
NWF.FormFiller.Events.RegisterAfterReady(function(){
NWF$('.duplicates').each(function(){Update(this.id);});
});
function Update(control){
var usednames={};
NWF$("select[id="+control+"]>option").each(function(){
if(usednames[this.text]){$(this).remove();}
else{usednames[this.text]=this.value;}
});
}
On the Nintex (Classic) Form I have cascading lookup controls that only populate after a selection is made in the previous control. When a user selects lkup_Dept then lkup_Div populates based on the lkup_Dept selection, and so on down the list. Without input from the previous lookup controls, the lower controls remain blank.
lkup_Dept
lkup_Div
lkup_Branch
lkup_Section
Because lkup_Dept is the only control that is set to populate on form load, the JavaScript control ‘duplicates’ only runs on the lkup_Dept control. You know where I’m going with this.
I’d like to setup a JavaScript EventListener that runs the Update function on the form’s next-in-line lookup control whenever a selection is made or changed to the previous control.
Thanks for your help.