Where are custom field descriptions stored and written to html?

I'm embedding javascript into a custom field's "description" input field. This field is normally used for storing description labels for custom fields. However, It can also be used to store field-specific javascript (I'm using jQuery).

My problem is that, although my script seems to work on my preliminary tests, I can't locate the script in the DOM in order to verify its presence and do trace testing.

Using Chrome's developer tools inspector menu, I can click on the description and see the text in the inspector panel. However, I can't see the script there. I know its present somewhere in the DOM because my jQuery is formatting the description input as written.

Can anyone shed light on where the script is written to the DOM?

Here's the contents of the description field:

This is the calculated estimate field
<script type="text/javascript">
jQuery(document).ready(function(){

    jQuery("#customfield_21070").attr('style','width:60px');
    jQuery("#customfield_21070").attr('disabled','disabled');

    var customfields = [
    '#customfield_11070',
    '#customfield_11071',
    '#customfield_20071',
    '#customfield_20072',   
    '#customfield_20073',
    '#customfield_20074',
    ];

	for(var i=0, len=customfields.length; i<len; i++) {
		console.log(customfields[i]);
		jQuery(customfields[i]).keyup(function(){
			calculateSum().call(this);
		});
	}
  

    function calculateSum(field) {

        var sum = 0;
		
		if(!isNaN(field.value) && field.value.length!=0 && field.id !== "customfield_21070") {
			sum += parseFloat(field.value);
		}
	
        jQuery("#customfield_21070").val(sum.toFixed(2));
    }
	
});
</script>

2 answers

This widget could not be displayed.

Hi,

Check if the script is put in the right scheme configuration fields on issuetype

Hi zezeto, I've placed my script into the custom field (customfield_21070) via this path:

Adminstration > Fields > Custom Fields > (Calculated Estimate) > Edit Custom Field Details

The customfield_21070 input element is referenced as "Calculated Estimate" on the Custom Fields screen. That's where I've placed my code and field label.

I can verify that my label is present, and it also changes as expected, when I edit the custom field. However, the problem remains that the script that's placed just below the field label cannot be found in the DOM. I would expect the script to appear directly below the field label in the DOM. However, its not there.

Bottom line: the script works perfectly. However, I can't locate it in the DOM in the expected location.

This widget could not be displayed.

Hi,

You can see the description, if you open this url http://yourhostname:port/jira/secure/CreateIssue.jspa in a new tab

I'm not sure I'm communicating the problem clearly.

There is no problem seeing the description. See my notes above. The problem is that when I view the live page and try to inspect the DOM, I can't see the script that's in the same field as the description. But I surely CAN see the description fine.

As @zezeto said, open it in a new page and you will see the javascript in the DOM. In the normal case, create screen is a popup and thta is why it is missing from the DOM I guess.

I see. We don't have this field on our issue creation screen. Its only on the Issue edit screen.

Same logic :)

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

34 views 0 1
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