How catch event of TransitionScreen submit-button click (Jira Server)

Good day!

I have Jira Server 8.5.x. I need make some validation and show aui-dialog2 if validation is failed after submit button click in transition screen.
My js and soy templates use atl.general context.

Transition active-button (on issue page) and submit-button have same name (and I can’t change them). So if i use if (AJS.$('#issue-workflow-transition-submit').val() == my_transitionName ){ ...} it works twice on action-button and TransitionScreens submit-button click. :confused:

I success hang my validation and dialog2 show code on action-button (i use event.preventDefault(); and event.stopPropagation() for pause transition action process), but it happened before a TransitionScreen is appeared. I found id of this screen workflow-transition-5-dialog but have no idea how work on this screen and start validation after submit-button.

I know that is more correct make all validation in backend-side of my plugin, but I don’t know how rendering dialog2.soy in backend.:slightly_frowning_face:

There shouldn’t be 2 elements with the same Id on the same page.
I can’t find such a button in a pure Jira instance.

I’m not sure what is the “Transition active-button”. Is it created by your plugin/ or a different plugin installed on the instance?

If there are two such buttons you can use a more specific selector to target the one you want, like $('form#issue-workflow-transition #issue-workflow-transition-submit')

or $('#issue-workflow-transition-submit[name="Transition"]')


it works twice on action-button and TransitionScreens submit-button click

Is the JS function attaching event listeners executing multiple times?

but it happened before a TransitionScreen is appeared.

Please explain what exactly you are trying to do. Are you trying to validate fields in an issue transition dialog?
Or you trying to validate some data in issue view before a transition dialog appears?
Are you trying to block a transition dialog from appearing or submitting?

Hi, tjoy!

Thank you for your answer!

I found way out of my problem similar as your solution: i use transitionDialogID (’#workflow-transition-’ + action_id + ‘-dialog’) and AJS.$(transitionDialogId).on/off(‘before-submit’, ‘#issue-workflow-transition-submit’, myDialogFunction);

My next problem is working js code before transition validators (that added in workflow). I don’t find any solution and make a post-function with some action from js. JS Dialog was now a non-blocking validator (warning dialog with continue/cancel buttons). It’s maybe not good realization but works great!

I want to know, it’s possible hang js functions on #issue-workflow-transition-submit after transition validator?