Lookup Doesn't Always Work

May 13, 2010 at 5:47 AM

I have used SPFF in a few scenarios over the past few weeks and been quite pleased.  I am currently running into a problem which I cannot diagnose.  I am passing in a parametre Cust=MyCustomer into a form with SPFF installed.  Cust is a lookup and I have confirmed MyCustomer exists, yet Cust remains unassigned.  This did not happen with any of my other lists and so is puzzling to me.  Can you think of a scenario where this might occur?  I have checked for hidden characters, confirmed the field name is correct, etc.





May 13, 2010 at 2:05 PM
Edited May 13, 2010 at 3:42 PM
Vlad, Lookups render differently in IE than other browsers, so you could try changing browsers to see if there is a clue. Also try using the @ID method to select the value and see if that works. If that works, it finds the field ok, but the value does not match. Some sanitation happens to data before it gets sent through to the matcher, you can see the output if you use Firefox and Firebug and add a console.log message to your script. On line 32 of the script in the function getKv(), do this: Change: {{ getKv = function(){ $.each(params,function(i,e){ var p=e.split("="); // you can't have = or & in the value kv[p[0]]=decodeURIComponent(p[1]); //some cleaning of URI entities happens here so % will probably cause errors too }); return kv; }, TO: getKv = function(){ $.each(params,function(i,e){ var p=e.split("="); kv[p[0]]=decodeURIComponent(p[1]); }); console.log(kv); //new line for debugging return kv; }, }}
May 14, 2010 at 3:52 PM

Coordinator - Thank you for the response.  I did a bit more investigation and discovered the lists that were having problems were rendering HTML in the format (in IE):

<option value=0>Alpha</option>

<option value=1>Beta</option>

...and so on.

While the lists that worked returned selections in one long list in the choices attribute.  It may have something to do with the number of lookup values returned.

Also note that the <option> approach is used by Chrome as well and therefore fails to work.


Jan 12, 2011 at 12:48 PM

Was a solution found to this?

If the multi select field is set to required.

It seems to make the selection on a multi select lookup but it doesn't move the selection out of the left hand column.

If you then move the same item from the left hand column into the right, it re adds it and then you are able to apply the newform item.

When you check this item it the multi selection appears like: option 1, option 1, option 2 (1 of the 'option 1''s being what you moved over)


If you simply try and apply the newform item without changing anything, then you will receive the message about you must specify a value etc.

Tried this in IE and Firefox, with names and ID's. Same problem.

Jan 12, 2011 at 3:56 PM

From looking at how multi select fields work.
I suspect it's something todo with the onclick events that are trigered when you click add or remove.

Feb 7, 2011 at 5:27 PM

the script doesn't seem to work when a browser renders the lookup field as

<option value=X>Y</option>

I'm not up on JS so i don't know what can be done to fix this, has anyone found a solution?

Feb 10, 2011 at 7:26 PM

Here is how I fixed this problem:

in the spff.js file, look for case 10.

Replace it with this code:

case 10:
                    if (v.substring(0,1)=="@"){
                        opts = f[0].options;
                            if (opts[i].value==v.substring(1)){
     var hlink = $(f).siblings("input[title='Description']");
     if (hlink.length>0){
      f = f.add(hlink);
      if (f[0].type=="select-one"&&f[0].tagName=="SELECT"){
       opts = f[0].options;
        if (opts[i].text==v){
      else {
                    if (f[0].tagName=="TEXTAREA" && o.lock===true){


The red code is what I had to change to make it work.


Jun 2, 2011 at 10:45 AM

It seems that anything over 20 items in a lookup throws ssff off.

Jun 3, 2011 at 3:13 AM

try looking here for more info on how SP handles lookup > 20 items. http://geekswithblogs.net/SoYouKnow/archive/2011/04/06/setting-sharepoint-drop-down-lists-w-jquery---20-items.aspx