Button that refreshes the same page

I have a requirement to add a "Test Connection" button to my task. When the button is clicked, based on the action response, the page should show a section which says whether the connection is successful or not. I could add the button and my action is triggered, however, different page is re-loaded. Is there a attribute to specify type="reload"?

4 answers

1 accepted

0 vote

Look at some samples with JS resources, for example https://bitbucket.org/atlassian/bamboo-build-times-plugin

You need to define web-resource element in atlassian-plugin.xml, it will be added to bundled and minified JS code then you can use it on your page

0 vote

You should create rest endpoint at server side and use JS to submit data from UI to this REST resource. So form will be not submitted, but all interaction between web page and server should be handled by AJAX

Thanks Alexey,

Now struck with weird problem. If I inline the JS code, the function gets called, however including it via src='... doesn't work. Any help is appreciated.

Works...

<html>
 <script>
	function myFunction() {
		alert("Hello");
	}
 </script>
 <body>
 [@ww.textfield labelKey="echoString.label" name="echoString" description="echoString.description" required='true'/]
 <input type="button" class="button" value="Click Me" onclick="myFunction()" />
 </body>
 </html>

Doesn't work

<html>
 <script src="/js/helloworld.js">
 </script>
 <body>
 [@ww.textfield labelKey="echoString.label" name="echoString" description="echoString.description" required='true'/]
 <input type="button" class="button" value="Click Me" onclick="myFunction()" />
 </body>
 </html>

Can you also point me to samples, where the task UI config class and the ftl files can be kept in sync. I mean when the button is clicked, the UI should display a section with the status message.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,493 views 0 5
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