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 votes
Accepted answer

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 votes

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
Community showcase
Posted 6 hours ago in Jira Service Desk

Looking for anyone who has switched from Zendesk to Jira Service Desk

Hi Community! The Jira Service Desk marketing team is looking for customers who have successfully switched from Zendesk to Jira Service Desk!   We’d love to hear your thoughts on the pros and ...

11 views 0 1
Join discussion

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