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

Deleted user October 2, 2012

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

0 votes
Answer accepted
Deleted user November 29, 2012

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
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.
November 29, 2012

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

Deleted user November 29, 2012

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 votes
Deleted user October 2, 2012

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
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.
November 29, 2012

Ian did you find any more info about this?

0 votes
JamieA
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.
October 2, 2012

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events