Creating a SingleSelect UserPicker in velocity

Georg Steinmetz October 10, 2013

Hello,

I wrote a plugin for JIRA that has a velocity template with a form on it. Inside this form (and for the further functions) it is neccessary to give a username.

Now I wanted to add a such a selection as in the "create new project" dialog, where you can search for users (with autocomplete and the list, that looks similar to a dropdownlist of a <form><select>)

How can I add such a field to my velocity?

Thank You

2 answers

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
Florin Manaila
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.
October 10, 2013

1. Create a standard user picker custom field

2. Get a browser extension that will turn off javascript

3. Open an issue and click "Edit" with javascript turned off

4. Copy and paste the userpicker HTML markup to your page

5. Change any "name" and "id" attributes to suit your needs

... and you're done.

If this doesn't work look for the resource that contains the initUserPickers.js file and #require it in your page.

Georg Steinmetz October 10, 2013

Thank you for that great tip!

I've got a select field that looks like that one on the edit issue page

Great!

0 votes
Mizan
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.
October 10, 2013

You can use the existing JIRA css classes in your select in VM . Also refer this http://pastebin.com/RnRJJPbm

Georg Steinmetz October 10, 2013

Thanks for the quick answer.

I pasted the code from pastebin (the HTML into the *.vm and the script into an external *.js), but when I enter the Page it looks like this:

TAGS
AUG Leaders

Atlassian Community Events