SPLookupAddNew Not a Lookup Column

Jun 7, 2010 at 1:58 PM

Have the following which works perfectly...

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<!--<script type="text/javascript">alert("JS Working");</script>-->
<script language="javascript" type="text/javascript" src="/JQuery/jquery-1.4.2.js"></script>
<script language="javascript" type="text/javascript" src="/JQuery/jquery.SPServices-0.5.5.js"></script>
<script type="text/javascript">
  $(document).ready(function() {
      lookupColumn: "Project Name",
      promptText: "Add New {0}",
      completefunc: null,
      debug: true

if I add (or replace with)

      lookupColumn: "Assigned_To",
      promptText: "Add New {0}",
      completefunc: null,
      debug: true

I get 
      Error in function
      lookupColumn: Assigned_To
      This column does not appear to be a lookup column

I have a List called Assignment List that this column is a lookup for...
I've added a new column with a different name pointing to this but still get the same results...

Any ideas?


Jun 7, 2010 at 6:03 PM

The "lookupColumn" should be the display name of the column. Does your "Assigned_To" column name really have an underscore in it?


Jun 7, 2010 at 6:16 PM

Yes it does. I've tried to create an new lookup column with a different name, but get the same results. I even created a new List (thinking it might be the list itself) with a new Column name, but no matter what I put I get the same above error.
It is confusing because if I use the "Project Name" it works fine - but try to use another Lookup column and I get the error.
Unfortunately I'm new to JQuery so don't have much to go on...if there is a way to hard code it maybe?

Jun 7, 2010 at 6:40 PM

You're sure it's the DisplayName for the column on the current form?  It needs to be the DisplayName of the column on the current form, not in the list which the column is a lookup into.


Jun 7, 2010 at 6:45 PM

Used the SPGetStaticFromDisplay and SPGetDisplayFromStatic utilities to get the following:

Static: Project_x0020_Name
Display: Project Name

Static: Assigned
Display: Assigned_To

Jun 7, 2010 at 6:56 PM

Created a new column called Assignments (Lookup) pointed at the list - same error

Created a new List called Projects Assigned, created a lookup column called Project Assigned to point at new list - same error

Jun 7, 2010 at 6:56 PM
Edited Jun 7, 2010 at 7:24 PM

Rather than trying to determine the name using the functions, use the Developer Tools (IE8) to check the Title of the select (dropdown) in the DOM.  For example:

<select name="ctl00$m$g_e845e690_00da_428f_afbd_fbe804787763$ctl00$ctl04$ctl05$ctl00$ctl00$ctl04$ctl00$Lookup" title="Region" id="ctl00_m_g_e845e690_00da_428f_afbd_fbe804787763_ctl00_ctl04_ctl05_ctl00_ctl00_ctl04_ctl00_Lookup" lpcachedvisval="1" lpcachedvistime="1275936802" jQuery1275936790525="2" cascadeDropdownSelected_State="Northeast" showRelatedSelected="Northeast">

In this case, the DisplayName is Region, which is seen in the title attribute.


Jun 7, 2010 at 7:23 PM

<TD valign="top" class="ms-formbody" width="400px">
  <!-- FieldName="Assigned_To"
   <span dir="none"><select name="ctl00$m$g_051a2a8b_a7c0_4aa5_8355_49f9ff75d5db$ctl00$ctl04$ctl13$ctl00$ctl00$ctl04$ctl00$Lookup" id="ctl00_m_g_051a2a8b_a7c0_4aa5_8355_49f9ff75d5db_ctl00_ctl04_ctl13_ctl00_ctl00_ctl04_ctl00_Lookup" title="Assigned_To">
     <option value="0">(None)</option>
     <option value="1">Smith, Joe</option>
     <option value="2">Smith, Jill</option>
     <option value="3">Smith, John</option>
     <option value="4">Smith, Joe; Smith, Jill</option>

Jun 7, 2010 at 7:37 PM

Where is the lookup list relative to the form?  Is the "Project Name" lookup list in the same location as the "Assigned_To" lookup list?


Jun 7, 2010 at 8:07 PM

I have 3 Lists
   Project Tasks 
         Column (click to edit)       Type                                 Required  
         Project Name                  Lookup  
         Task Name                     Single line of text                Yes
         Priority                           Choice  
         Status                             Choice  
         Task Type                       Choice  
         Start Date                       Date and Time  
         Due Date                        Date and Time  
         Date Completed              Date and Time  
         % Complete                    Number  
         Date Created                   Date and Time  
         Comments                       Multiple lines of text  
         Data Request Link             Hyperlink or Picture  
         Order (Working)               Number  
         Assigned_To                     Lookup  
         Created By                       Person or Group   
         Modified By                     Person or Group

 Projects Lists 
       Column (click to edit)                Type                         Required  
       Project Name                          Single line of text        Yes   
       Description                              Multiple lines of text  
       Created By                              Person or Group   
       Modified By                             Person or Group  

 Assignment List
        Column (click to edit)                   Type                          Required  
        Name or Group                          Single line of text         Yes   
        E-Mail                                        Single line of text  
        Created By                                  Person or Group   
        Modified By                                Person or Group 

Project Name Lookup in Project Tasks points to Project Lists "Project Name"
Assigned_To Lookup in Project Tasks points to Assignment List "Name or Group"

Jun 7, 2010 at 8:10 PM
Edited Jun 7, 2010 at 8:10 PM

Thanks. and are all of the lists in the same site?  Did you create these lists or are they coming from one of the Fabulous 40 templates or something?


Jun 7, 2010 at 8:19 PM

Okay, don't shoot me -

There were 2 Project Tasks Lists (Project Tasks v1 (had old data) and Project Tasks)

I deleted Project Tasks v1, closed/opened SPD and readded code - It now works!

I swear I was updating the correct List in SPD (Project Tasks) - so I can only assume something was stuck somewhere...sorry for the hunting - but I did learn a few things, and thanks for the support.

Jun 7, 2010 at 8:22 PM

This stuff happens to everyone.  Glad you got it working!  Always nice to find that it's not my issue. ;+)