Hey there,
I’m implementing a version manager plugin for jira. At the moment I’m using a webworkAction-class to call my .vm file which gives me an interface on the jira page. From there I want to call a method in the webworkAction-class only when a button is clicked. Here are my questions:
1. The method is automatically called when the page loads, without clicking the button. And isn’t called then when the button is clicked. Is there a way to prevent this?
2. How can I hand over all parameters from the UI (only Strings) with the method? I always get null.
Thanks for your help!
VersionManagerWebworkAction.java:
public class VersionManagerWebworkAction extends JiraWebActionSupport
{
private static final Logger log = LoggerFactory.getLogger(VersionManagerWebworkAction.class);
@Override
public String execute() throws Exception {
return "version-manager-success";
}
public void createNewFixVersion(String versionName) {
//Problem: This method is called when page loaded
System.out.println(versionName);
}
}
version-manager-success.vm:
<!DOCTYPE html>
<html>
<head>
...
</head>
<body>
...
<input id="version" style="width:231px;" type="text" name="version">
...
<button onclick="createButtonAction()">Create</button>
<script>
function createButtonAction() {
if(document.getElementById("version").value.length == 0){
...
}else{
$versionValue = document.getElementById("version").value;
$!action.createNewFixVersion( $versionValue );
}
}
</script>
</body>
</html>