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

How do I ensure my JavaScript gets loaded when switching issue types?

Oskari Rautiainen July 17, 2012

We are using JavaScript to further customize the fields in JIRA 5.0. The JavaScript is placed in the descriptions of fields on the screen we wish to modify. Some of the customizations include disabling certain fields based on the value of a field, querying options for a select list from an external database, and automatically filling in a text field based on the values of other fields.

We have come across one major blocker and I was wondering if anyone knew of a work around. Basically when you are in the Create screen and switch between issue types or projects not only is the JavaScript for the new issue type not loaded but if you go back to the original issue type that JavaScript is no longer working either. Is there anyway to ensure that the JavaScript is loaded when you switch between issue types?

Any help would be gratefully appreciated.

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Christian Czaia _Decadis AG_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 2, 2013

I had the same problem once. That's how I solved it:

<script type="text/javascript">
jQuery(document).ready(function($) {
  functionXYZ();
  JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) { functionXYZ(); });
});

/*Your code*/
function functionXYZ() {
  if ....
	
}

</script>

0 votes
MarcoBaldo June 2, 2013

the code has to be written like Harry told you. But in my case was not having the behaviour I wanted, so I removed the code from the "description" of my field and put it in the "announcement banner" in the "user interface". You can also try it!

0 votes
Harry Chan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 28, 2012

Hi, refer to https://answers.atlassian.com/questions/79201/jira-5-1-2-questions-re-pop-up-issue-edit-window?page=1#80503. It sounds like you are facing an issue with the way Javascript is now handled in JIRA 5.x.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events