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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

aui-select with initial value on load

I'm using the aui-select control with AJAX calls to retrieve the list to be displayed. How can I set the initial value of this control (for example in a View/Edit form?)



4 answers

Hi Raffee,

Try this:


Hope this helps,


Hi Frederic,

Thanks for your answer, but this doesn't seem to be working.

When I write your suggested line: 


and then directly try :


I get "" as a result, and the Select box is still empty.


Here is my HTML for more info:

<aui-select id="AccountTypeId"
placeholder="Select a Type"
value="type to search types">




Hi Raffee,

You should use .val() with an argument (the value you want to select). For instance, .val('value 1'); . If not working, try to append the trigger() method, like this: .val('value 1').trigger('change');

Hope that helps,


Hello Frederic,

And thank you for your continuing support :smile:

I tried your suggestion (using the JQuery val('value').trigger('change') but again it is not working. I think this would work fine with preloaded options, but not when using asynchronous loading with AJAX.

We were able to grab and set the value of the "input" inside the select, but again it's value will remain "" (no value) and the specified option will not be selected.


If it's not too much to ask, do you have a working sample that you can provide?


Thanks again and regards,


To give you a better idea, here are the details of our tests on JS Bin (using the sample provided on



Fake Rest API using:
Sample API:
Sample Result:
"label": "Product1",
"value": 1
"label": "Product2",
"value": 2
"label": "Product3",
"value": 3
"label": "Product4",
"value": 4

Mocky screenshot



JS BIN Code:
<!-- External dependencies -->
<script src=""></script>
<script src=""></script>
<script src="//"></script>
<script src="//"></script>
<script src="//"></script>
<link rel="stylesheet" type="text/css" href="//"/>
<link rel="stylesheet" type="text/css" href="//"/>
<!-- / External dependencies -->
<form class="aui">
<aui-label for="async-product-single-select">Choose your product asynchronously (you need to type to initiate a search):</aui-label>
placeholder="Select a product"
value="type to trigger async">

I see, the loading is asynchronous. In this case, how about using the AP Atlassian connect module (see, and use the success method which is called after the asynchronous call is done without error, like this:

AP.require('request', function(request)
url: your_url_here,
type: "GET",
dataType: "json",
contentType: "application/json",
async: true,
success : function (response)
//$("#async-product-single-select").val("1"); to select option value 1


$('select').select2().select2('val', $('.select2 option:eq(1)').val()); to select first option in list
Like Sergey likes this

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

Happy New Year and Welcome New Marketplace Partner Program Partners!

Happy New Year! We hope you all had a safe and restful holiday season. 2020 was a unique year full of unforeseen events; however, as we enter the new year of 2021, we’re optimistic for the light at t...

641 views 7 23
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you