Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Dropdown menu (or any other solution) of users in velocity template

Alex M March 21, 2013

Hi,

Is it possible (in Confluence) to create a dropdown menu or anything similar (e.g. user picker) in a input text field of a velocity template? If yes is there any documentation about it?

Cheers.

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Tim
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 23, 2013

Take a look at

\atlassian-confluence-4.3.7\confluence\includes\js\components\binders\autocomplete-content.js

Unfortunately there is no function implemented to autocomplete users only, but you can edit the file and just add

Confluence.Binder.autocompleteUserinfo = function(scope) {
        scope = scope || document.body;
        $("input.autocomplete-userinfo", scope).each(function() {
            mybind(this, "userinfo", "{title}", contentDisplayHandler);
        });
    };

In addition you need this markup in your velocity template:

<div class="userinfo-binder">
                <input type="text" class="autocomplete-userinfo" id="foo" name="bar" data-max="10" data-none-message="No results" data-template="{title}" />
            </div>

and you need to bind your new function:

AJS.toInit(function() {
    Confluence.Binder.autocompleteUserinfo(AJS.$(".userinfo-binder"));
});

Alex M April 24, 2013

It seems to be it! :) Cheers mate.

TAGS
AUG Leaders

Atlassian Community Events