Script Tags in Field descriptions not working in Create/Edit Dialog boxes

In previous versions of JIRA (4.4.4 and earlier) script tags could be included within the description of a field. One example use of this would be to hide/show a one field (e.g. Priority Explanation) based on the value of a previous field (e.g. priority = Critical).

Since upgrading to JIRA 5.1.4, it appears that the script tags (and its contents) are stripped from a description of a field when rendered in the new create/edit dialog boxes. However, when using the CreateIssue.jspa page to enter issues, the script tags are rendered and therefore function as expected.

Is this by design? If so is there any recommended work around?

Thanks

Ian

3 answers

1 accepted

Yes and no!

After some discussion with Atlassian support, during which they were unable to identify (or recreate) the problem, a screen sharing session was arranged.

During the session I was able to demonstrate the problem to Atlassian on 2 different browsers (IE & Chrome). All the admin settings for fields, screens and projects were checked and seemed to be configured correctly, the indexes were cleared, JIRA was restarted and the browser cache was flushed in Chrome with no effect.

Finally, a new field with the same settings (but different name) was created an added to all screens. A second refresh of the cache was performed and the new field and the existing field began to work! The new field was then deleted, the cache refreshed for a third time and the problem has gone away.

Atlassian have chalked it up to a browser cache or index problem - three weeks on the problem has not reappeared!?!?!?!?!

Colin Goudie Community Champion Nov 29, 2012

Wow really!! Ok, I'll give that a try

Hi Colin

We did subsequently experience a problem which we (wrongly) immediately assumed to be the same problem recurring. It turned out that one of the Field Configurations had a different description for the field which didn't include the script so that may be something worth looking at too!

Good luck!

0 vote

Is this self-hosted jira? If so are you sure they're getting stripped - possibly they are just getting executed too early. Can you paste an example of one of your scripts?

https://developer.atlassian.com/display/JIRADEV/Preparing+for+JIRA+5.1#PreparingforJIRA5.1-CustomFieldsthatuseCSSorJavaScriptWebResources

Hi Jamie

Yes I am using a self-hosted jira, but as I am not using a Custom Field plugin I hadn't looked at the developer notes during the preparation for the 5.1.4 upgrade :(

Here's how my custom field (id = 10030) is configured (via the Custom Fields page in the JIRA Administration section):

  • Field Type: Free Text Field (unlimited text)
  • Field Name: Priority Explanation
  • Description:
    Please provide an explanation when selecting a priority of <em>Critical</em>.
    <script type="text/javascript">
    	var priority = AJS.$('#priority');
    	if (priority) {
    		var priorityExplanation = AJS.$('#customfield_10030');
    		// Hide the target field if priority isn't critical
    		if (priority.val() != '2')
    		{
    			priorityExplanation.parent().hide();
    		}
    		priority.change(function() 
    		{
    			var priority = AJS.$('#priority');
    			var priorityExplanation = AJS.$('#customfield_10030');
    			if (priority.val() == '2')
    			{
    				priorityExplanation.parent().show();
    			} else {
    				priorityExplanation.parent().hide();
    			}
    		});
    	}
     </script>

On the classic Create Issue page (/secure/CreateIssue.jspa) the Javascript works and can be seen by viewing source or inspecting the elements!

On the new Creat/Edit dialog boxes, the Javascript does not work nor is it viewable in the page source or by inspecting the elements!?!?

Thanks for any help you can provide!

Ian

Colin Goudie Community Champion Nov 29, 2012

Ian did you find any more info about this?

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Wednesday in Jira

Join our webinar: How 1B+ feature flag events helped us build the new Jira

Every time you release software, there's a bit of risk – that there's a bug, that something breaks, or that the feature doesn't resonate with customers. Feature flagging helps make high stakes s...

113 views 0 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you