cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Nintex Newbie

Re: Set default value to lookup field stopped working after Nintex Forms 2013 latest update

Jump to solution

How can i set value of of multiple list lookup controls filtered with a single line text field to a single line of text field? All the lookups values are coming from one list. I am using different views on the lookup list. I am using panels to hide list lookup controls that are not filtered. Only some list lookup controls sets connected ids while others don’t.

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Set default value to lookup field stopped working after Nintex Forms 2013 latest update

Jump to solution

Assuming having a querystring parameter location and a client-ID-Variable LocationField.

Here is complete code which works for me. 

NWF.FormFiller.Events.RegisterAfterReady(function () {
    assignLocation();
});

function assignLocation() {
   var loc = getParams("location");
   var lIndex = -1;
 
   if(loc != null) {
	    NWF$("#" + LocationField).parent().find("OPTION").each(function () {  
			if(NWF$(this).html() == loc) {
				lIndex = NWF$(this).val();	
				NWF$(this).attr("selected", true); 
				return false;
			}
	   });
	}
}

function getParams(key) {
	var result = null, tmp = [];
	var items = location.search.substr(1).split("&");
 
	for (var index = 0; index < items.length; index++) {
	  tmp = items[index].split("=");
	  if (tmp[0] === key) result = decodeURIComponent(tmp[1]);
	}
 
	return result;
}

Hope that helps others. I was struggeling around more than two hours.

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Set default value to lookup field stopped working after Nintex Forms 2013 latest update

Jump to solution

call NWF$(this).change(); right after

NWF$(this).attr("selected", true);

Otherwise you get an error message regarding a required field when saving the form.

0 Kudos
Reply