I have an Atlassian SDK webwork1 module with its view:
<webwork1 key="ai-config" name="AI Config" i18n-name-key="ai-config.name"> <description key="ai-config.description">The AI Config Plugin</description> <actions> <action name="com.softgile.jira.webwork.AIConfigAction" alias="AIConfigAction"><view name="success">/templates/ai-config/success.vm</view> </action> </actions> </webwork1>
In the view I have several forms:
<form class="aui" id="configForm" method="post" action="AIConfigAction!saveIp.jspa">...</form><form class="aui" id="serviceName" method="post" action="AIConfigAction!saveService.jspa">...</form>
Also I have a button there, which is controlled with JS:
<div class="field-group"><label for="authenticate"><span class="aui-icon aui-icon-large aui-iconfont-app-access">Insert meaningful text here for accessibility</span></label><div class="buttons"><button class="aui-button aui-button-primary" id="authenticate">Authenticate</button></div></div>
In JS file I have something like this:
AJS.toInit(function(){ AJS.$(document).on('click', '#authenticate', function(e) { e.preventDefault(); alert("authenticate"); });});
Both forms work okay, and JS works when I click the button. But JS stops working when I submit one of the forms, it works only before submitting forms. I see that URL is changing from AIConfigAction.jspa
to AIConfigAction!saveService.jspa
and in that case JS not working. How can I make JS work?