Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Binding javascript to dialog created with AJS.FormPopup

Robert Jahrling
Contributor
January 9, 2019

Let's say that I am following https://checkup.atlassian.com/server/jira/platform/tutorial-how-to-create-an-ajax-dialog-4227197/ and I want to add a select list to the dialog that we've created with AJS.FormPopup.

Easy, no problem, modify the .vm file and you're set.

What if you want to bind a function to the select list's change event? 

How do you get this dialog to import JavaScript?

$webResourceManager.requireResource(), which works in other contexts, doesn't work here. CSS and JS files just don't get loaded.

Adding code to the javascript file you create in this tutorial doesn't work either, unless I'm doing something incredibly wrong by adding


$('#selector').change(function() {

  //do stuff

});

 

How can I do this?

2 answers

1 accepted

0 votes
Answer accepted
Robert Jahrling
Contributor
January 10, 2019
<script>

 #include("/js/dialog-js.js")

</script>

 

works, but I kind of feel like there should be a better way.

Robert Jahrling
Contributor
January 10, 2019

(in the velocity template, obviously)

0 votes
Robert Jahrling
Contributor
January 10, 2019

Adding resources to the jira.popup context appears to have no effect.

Creating a custom context appears to have no effect.

Is the only solution to include my javascript in a script tag?

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, loom, loom for training, loom for teaching, video training, async learning, online education, screen recording, loom tutorials, loom use cases, atlassian learning, team training tools, instructional video, virtual training tools

🛗 Elevate Your Training and Enablement with Loom

Join us June 26, 11am PT for a webinar with Atlassian Champion Robert Hean & Loom’s Brittany Soinski. Hear tips, stories, and get your burning questions answered. Learn how Loom makes training and enablement easier. Don’t miss it!

Register today
AUG Leaders

Atlassian Community Events