SPLookupAddNew - This column does not appear to be a lookup column

Aug 6, 2010 at 3:59 AM

Here's the code I'm using:

 

<script language="javascript" type="text/javascript">

$(document).ready(function () 
{
	$().SPServices.SPLookupAddNew({	
		lookupColumn: "Continent",
		promptText: "Add new {0}",
		completefunc: null,
		debug: true
	});
});

</script>	

I'm using jQuery v. 1.4.2 and SPServices v. 0.5.6 and I'm trying to simply use this code.  I'm not using a site column, I'm using a lookup column that looks up Continents from another list within the site.  No matter what I try, I keep getting that error message.  Can you spot what I'm doing wrong?

Cheers,

Matt

Coordinator
Aug 6, 2010 at 4:04 AM

Hey, Matt.

Does the column in the list have a DisplayName of Continent?  And are you using this on the NewForm or EditForm pages? (Copies of whichever, of course.)

M.

Aug 6, 2010 at 2:11 PM

Yes, the column name that is rendered to the page is called: Continent  

The static name is the same though: _layouts/FldEditEx.aspx?List=%7B6587877D%2DDA41%2D414C%2D9F30%2D9647304AE8B4%7D&Field=Continent

I couldn't remember if this was a form copied over or a list form I created from scratch, so I copied the newform.aspx over to a doc library and tried the same code and got the same result.  I have to be missing some super simple from within the documentation.  I just don't see it though.  I have a really simple setup:

Countries custom list; Fields: Title(Country Name) & Continent(Lookup Column to Continents List)

Continents custom list; Fields: Title(Continent Name)

Like I said above, I have the code posted above on my newform.aspx but get the same results.  I know the jQuery and SPServices ref is good b/c the dialog box pops up with debug info.

 

Thanks for helping me along...

Matt

Coordinator
Aug 9, 2010 at 2:57 AM

Matt:

Which list's NewForm.aspx are you using the SPLookupAddNew function on?

M.

Aug 9, 2010 at 3:10 AM

I'm using the function on the Countries Newform.aspx page.

Coordinator
Aug 9, 2010 at 5:04 AM

I just checked the code for SPLookupAddNew, and you'd get that message if your NewForm.aspx page wasn't in the context of the list. For instance, if you've moved it from

/SiteName/Lists/Countries

to some other location. The function assumes that the form is in the usual list context and uses listNameFromUrl() to determine the current list's name.

Any chance that's it?

M.

Aug 9, 2010 at 2:51 PM
sympmarc wrote:

I just checked the code for SPLookupAddNew, and you'd get that message if your NewForm.aspx page wasn't in the context of the list. For instance, if you've moved it from

/SiteName/Lists/Countries

to some other location. The function assumes that the form is in the usual list context and uses listNameFromUrl() to determine the current list's name.

Any chance that's it?

M.

That is exactly what I've done...  I'll move it back and I'm sure it'll work.  I knew it had to have been something silly on my end...  Thanks for seeing it through as always!

Coordinator
Aug 10, 2010 at 2:10 AM
This is the support level I strive for so that I can earn the price you've paid for the software. Oh, wait. It's free. ;-) M.