This project has moved and is read-only. For the latest updates, please go here.

Using SPFilterDropdown in a self referencing lookup

Jun 7, 2013 at 7:51 PM
Edited Jun 7, 2013 at 8:04 PM

Most of the SPServices functions uses multiple lists in your examples. What I have is a single document library called 'Contracts', with a lookup called 'Contract Parent Title' (internal name ContractParentTitle) that self references the Contracts document library and displays the Title.

I'm also storing two other variables that the user selects, a lookup called 'Vendor Name' and a yes/no field called 'Subcontract'. I'd like to filter down the results that display in the 'Contract Parent Title' lookup based on the selections made to 'VendorName' and 'IsSubcontract' using CAML.

Is it possible to self reference the Contracts library using SPFilterDropdown?

I've tried the following bit of javascript in attempt to get it to run but it always results in an error:
  relationshipList: "Contracts",
  relationshipListColumn: "Title",
  columnName: "ContractParentTitle",
  CAMLQuery: "<Where><And><Eq><FieldRef Name='IsSubcontract' /><Value Type='Text'>False</Value></Eq><Eq><FieldRef Name='VendorName' /><Value Type='Text'>"+ vendorName +"</Value></Eq></And></Where>",
  completefunc: null,
  debug: true
Any thoughts?
Jun 7, 2013 at 9:04 PM
What's the error?

Jun 7, 2013 at 9:07 PM
Edited Jun 7, 2013 at 9:07 PM
Unfortunately it's pretty generic, Marc, so I can't say I have any idea of what's going on.

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; InfoPath.3; .NET4.0E; MS-RTC LM 8)
Timestamp: Fri, 7 Jun 2013 20:06:23 UTC

Message: Script error
Line: 0
Char: 0
Code: 0
Jun 8, 2013 at 4:40 PM
My guess is that jQuery isn't defined. Check your reference.

Jun 14, 2013 at 2:07 PM
Edited Jun 14, 2013 at 2:08 PM
That's, odd, myreferences to jQuery and SPServices seem to be correct and pull down both correctly:
<script src="//" type="text/javascript"></script>
<script src="//" type="text/javascript"></script>
Your suggested alert to retrieve the current site also runs perfectly: alert($().SPServices.SPGetCurrentSite());
Jun 14, 2013 at 2:14 PM
I would suggest using a more recent version of jQuery, though that may not be the problem. Try 1.8.3 or 1.10.1.

Also, the error that you show isn't what you'd see in the console in the Developer Tools. Take a look there for more details.

Jun 14, 2013 at 3:53 PM
Ah, it was my jQuery version. I bumped it up to 1.7.1 and all is well. As always, thanks Marc.
Jun 14, 2013 at 4:01 PM
Edited Jun 14, 2013 at 4:01 PM
Great! BTW, I've tested 1.10.1 in several places, and that's the version I'm going to be using for now.