This project has moved. For the latest updates, please go here.

SPFieldLookupMulti. Allow multiple values = Yes

Feb 3, 2011 at 7:49 AM

First thank you for such great utility!

My question is can you implement support for "SPFieldLookupMulti Allow multiple values = Yes (displays as two list boxes)"? With this function I can tune Calendar to add reservation Resource as default choice so users not need every time choose and click on add button.

Feb 3, 2011 at 2:02 PM
Edited Feb 4, 2011 at 8:11 PM

Thanks! I think I have some work to do on SPFieldLookup fields anyways.

I think the GetValue and SetValue functions should be able to take ID or text (ID is the list item ID from the lookup list and the text is what is actually displayed in the list). (*Edit* I should be clear that v0.6 doesn't work like this yet.. was just thinking out loud)


var lookupField = SPUtility.GetSPField('My Lookup Field');
lookupField.SetValue(3); // list item ID of the lookup item, doesn't change if list item is renamed
// *** or ***
lookupField.SetValue('Alpha'); // text that is displayed in the control

I'll work on getting the SPFieldLookupMulti field 100% over this weekend.

Feb 6, 2011 at 9:36 PM


I've pushed out a new changeset to support multi-select lookup fields: Can you try it out? If it works well for you I'll promote this changeset to the front page.

Here is the documentation page:




Feb 6, 2011 at 9:44 PM

I ended up just making it a release on the front page since I already updated the documentation and I didn't want to confuse anyone. You can download it either place.

Feb 7, 2011 at 6:47 AM

It works! Thank you!

But I still have a funny problem. In Reservations content type microsoft using FieldInternalName="Facilities" FieldType="SPFieldFacilities" which looks like a multi lookup, but if I try for example


I got an error: SetValue not yet implemented for SPFieldFacilities in Facilities.

I'm not a programmer and my tryouts to modify SPUtility.js was unsuccessful. I still get an error. Can you tell me what I must modify to make it work? :)

Feb 7, 2011 at 1:32 PM

That seems like a custom field type? What did you install to get those content types/fields?

If it is the same as a multi-select lookup field (SPFieldLookupMulti) then you could probably add one line in the getSPFieldFromType function.

On line 198, add a line:

case 'SPFieldLookupMulti':
case 'SPFieldFacilities':
	field = new SPLookupMultiField(spFieldParams);
Hopefully that helps!

Feb 7, 2011 at 2:13 PM

If you create Calendar and then go to 'List Settings->Title, description and navigation' you can enable 'Use this calendar for Resource Reservation?' option. Calendar will get new content type 'Reservations' with 'Resources' column. This column look in 'Resources' list for available items.

Adding lines was useless.

Anyway that not such a big problem. If you can later add this functionality in the future - it will be great. If not - so let it be :)

Feb 7, 2011 at 6:45 PM

Oh looks like this is available in SharePoint Online and/or SharePoint 2010 (link1 link2)?

I am focusing on getting support for SharePoint 2007 to be 100% (plus I don't currently have a SharePoint 2010 environment available) so I'll put this down as a TODO for a future release.

Feb 8, 2011 at 4:30 AM

Yes, it's in Sharepoint Foundation 2010.

Thank you :)

Aug 11, 2011 at 12:51 PM

Hi Kit,

I have one question. Is it possible to find the ID values of selected Items? If so, can you please give me an example...



Aug 11, 2011 at 6:48 PM
Edited Aug 11, 2011 at 6:50 PM


You can use the ListSelections property that is set on Multi-select Lookup field objects:

var field = SPUtility.GetSPField('My Multiselect Lookup Field');
var i, numOptions, id, text;
numOptions = field.ListSelections.options.length;
for (i = 0; i < numOptions; i += 1) {
	id = field.ListSelections.options[i].value;
	text = field.ListSelections.options[i].text;
	// do something with id and/or text
	alert('Item ID = ' + id + ' text = ' + text);

Perhaps I need to incorporate that into another method. Let me know how it goes. :)


Aug 12, 2011 at 4:22 AM
Edited Aug 12, 2011 at 4:35 AM

Thank you so much Kit..

Code is working like a charm !...