I am using plumFormAutocomplete jQuery plugin in NewForm.aspx to populate suggestions from sharepoint list (visitors) to fill one field (visitors name) and, based on the selection, autocomplete second field (work).

<script type="text/javascript">
$(document).ready(function () {
//get control for autocomplete field
var fieldControl = $.getFieldControl("Title");
//call autocomplete plugin for field control
sourceList: "visitors",
sourceMatchField: "Title",
labelFields: ['Title', 'work'],
labelSeparator: ', ',
fillConcatenatedLabel: false,
fieldsMapping: [{sourceField: 'work', targetField: 'work'},
        {sourceField: 'Title', targetField: 'Title'}]


Here when I start entering visitor's name from the list "visitors" it shows name suggestions combined with visitors work ("name, work"). And when I select name, it autocompletes work field.

The problem is, that in the "visitors" list there are many duplicate values and I want that suggestions won't be duplicate but grouped by visitors name:

duplicate suggestions

Tried to improvise in jquery.plumFormAutocomplete.js and add groupBy instead of orderBy but it doesn't change anything:

//get CAML query for keyword
function getCamlQuery(colname, keyword) {
var where = "<Where><Contains><FieldRef Name='" + colname + "'></FieldRef><Value Type='Text'>" + keyword + "</Value></Contains></Where>"
// var orderBy = "<OrderBy><FieldRef Name='" + colname + "' Ascending='False' /></OrderBy>"
var groupBy = "<GroupBy><FieldRef Name='" + colname + "'/></GroupBy>"
var query = "<Query>" + where + orderBy + groupBy + "</Query>";
return query;

Do you have any suggestions?

Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.