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

Button that refreshes the same page

Ramana Gyambavantha March 12, 2017

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
Answer accepted
Alexey Chystoprudov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 13, 2017

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
Ramana Gyambavantha March 22, 2017

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.

0 votes
Ramana Gyambavantha March 13, 2017

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>
0 votes
Alexey Chystoprudov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 12, 2017

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events