Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
  • 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.

Kiki M
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 11, 2016
 

2 answers

1 accepted

0 votes
Answer accepted
Heiko Gerlach
Contributor
December 12, 2016

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
Nic Brough -Adaptavist-
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.
December 12, 2016

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