Using two SharePoint lists with autocomplete

Jun 20, 2011 at 9:26 AM
Edited Jun 20, 2011 at 9:33 AM

Hi All,

I'm using the autocomplete function of SPServices with 1 SharePoint list.

Is it possible or can it use 2 SharePoint list to implement the textbox autocomplete?

Example

$(document).ready(function() {
 
    $().SPServices({
        operation: "GetListItems",
        async: true,
        listName: "List1","List2", <- Like this
        CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",
        completefunc: AttachAutoComplete
    });
Coordinator
Jun 20, 2011 at 12:17 PM

chukwe:

No, not as written. It's a relatively straightforward function which you could adapt to your needs, however.

You could simple add a second call to GetListItems, push those results into the array, and then process the superset. The one wrinkle is that you'd need to handle sorting the array differently.

M.

Jun 20, 2011 at 1:02 PM

Hi Sympmarc,

Thanks for your reply,

How do I implement that. Can you give me an example?

Thanks

Coordinator
Jun 20, 2011 at 1:48 PM

Well, I sort of gave you the steps required. The function as written takes a single list. You'd need to modify it to take two (or more, if you so desire) lists and then handle the data appropriately.

M.