• Community
  • Products
  • Jira
  • Questions
  • Users are confusing "Remaining" and "Log Work" - I need a way to disable / make "Remaining" a read-only field on Sub-Tasks/User Stories.

Users are confusing "Remaining" and "Log Work" - I need a way to disable / make "Remaining" a read-only field on Sub-Tasks/User Stories.

 

2 answers

1 accepted

Accepted Answer
0 votes

Hi Kiki,

Yes you can do it and you do not need to change or hack any core code. In general you can set the field to readonly via 

var myEle=AJS.$("#timetracking_remainingestimate").get(0);
	if (myEle!=null)
	{
		myEle.readOnly=true;   
	}

This is a mix of jQuery and Dom manipulation. Now the question is how to get this executed.

You can add javascript to any custom field description. So either you reuse an existing customfield or you create a new one. Add the javascript below to the description field and make sure the field is shown below the estimate field in the edit screen. You can move the fields in the field screen configuration.

Now this would work in single edit screens which have been opend in a separate tab, but it is not yet working in in page edit screen, e.g when clicking edit in the issue view. Note that AJS.$ is JIRAs jQuery implementation.

The tricky part is that the edit screen is loaded via ajax and so you can not rely on 

$(function() {
    console.log( "ready!" );
});

nor on 

$(document).ready(function() {
    console.log( "ready!" );
});

 

to get this triggered. I developed a workaround to over come this.

Here is the full example code

<script>
function disableEstimate() {
	var myEle=AJS.$("#timetracking_remainingestimate").get(0);
	if (myEle!=null)
	{
		myEle.readOnly=true;   
	}
};
</script>
<img onLoad="disableEstimate();void(0);" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/>

You might wonder about the hardcoded inline image. It is a transparent one pixel image and it is simply used to get an onLoad event as soon as our field has been loaded. 

 

Best Regards and please let me know whether this works for you.

Heiko 

0 votes

There's no simple way to do that without some hacking of the core code, which I would not recommend.

I suspect educating your users to look at what they're doing might be more useful

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 25, 2018 in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

461 views 7 5
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