• 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

This widget could not be displayed.

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 

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

257 views 5 0
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