• 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

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 vote

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
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
Published Thursday in Jira

Meet the AUG leaders of Northern Virginia

@Rachel Wright (Jira Genie), @Billy Poggi (AUG NOVA, DC), and @Dana Jansen (Confluence Queen) are just some of the folks that lead one of the world's most active Atlassian User Group (AUG)....

118 views 4 9
Read article

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