Select value on initial load with AUI single select

I'm trying to use the AUI single select component in an edit view; I'd like to select a value in the list on page load but can't figure out how to make it happen the right way.  

I've tried setting the 'value' property via javascript as described in the documentation, e.g. 

// Nothing is set by the following.  If I give the options a value and try to 
// set that, the same thing happens.
document.getElementById('login').value = 'Dropbox';
 
// Results in undefined
alert(document.getElementById('login').value);

It looks like I can set "selected='true'" on an option (not documented in the link above) which mostly works, but the associated image is not displayed in the selected value (see jsbin example.)

Is there some other way I should be going about this?  Thanks.

1 answer

1 accepted

1 vote
Sean Curtis Atlassian Team Jun 08, 2015

Adding the "selected" attribute to one of the <aui-option> elements is the right way to do this. Looks like there's a bug with it not rendering the icon though. I've raised https://ecosystem.atlassian.net/browse/AUI-3557 to track this.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Sunday in Agility

You asked for it, so we delivered: images on issues have arrived

A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...

895 views 3 12
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you