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

how to set default category in space list macro

The space list macro provides a list of spaces however the category value changes apparently to whatever was last used.


I need to set the value for the category list to a default value whenever the page is refreshed.


Tried the following but it had no effect.

		let teamOptions = document.getElementsByName("spacesSelectedTeam")[0].options;
		for (let i = 0; i < teamOptions.length; i++) {
			if (teamOptions[i].value == "ttgkb") {
				// Item is found, set its property and exit
				//teamOptions[i].selected = true;


1 answer

0 votes
Dominic Lagger Community Leader Nov 05, 2019

Hi @Stacy Ajouri 

Your approach is not very bad at first sight. But I have some questions.

  • Where did you add your code?
  • Would a user macro be acceptable?

Perhaps my little input helps you already to figure something out.

When I change the category it reloads the whole page with a new URL:


With this URL, you will always get to the page where the team "ttgkb" is selected. 

Hope it helps, Regards,


Hi, I just added it inside the page.  

A user macro may be possible.

The URL is okay but the user may go directory to the page from another path.

Dominic Lagger Community Leader Nov 06, 2019

Hi @Stacy Ajouri 

I think I know why the Javascript directly in the page did'nt work, because the space category macro wasn't loaded at this time. 

I added it in end of the body in the "Custom HTML" section in the administration console. There it worked, but not very user friendly... 
When you go to the page, it sets the category as excpected --> ttgkb. But because a manual change of the dropdown reloads the page, the script is executed again and the category ttgkb is selected again... That means you would never be able to change the category. 

The user macro didn't work out for me either. Because in the settings you cannot change the default dropdown value.

The only really dirty way I can think off would be:

  • Reload the page by javascript with the URL i gave to you
  • That would mean, when a person comes to this page, it would reload automatically and the right space category is set. 
  • Redirect with Javascript

Regards, Dominic

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

408 views 23 8
Join discussion

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