Hi,
I’ve a select list field that I want to change to read only after the issue was created. I still want to show it in all screens, but to prevent the users from changing the value.
How can this be done ?
Thanks,
Alon
You can use script for making any field readonly.
var fieldname= document.getElementById('customfield_xxxx');
fieldname.disabled=true;
You can use https://marketplace.atlassian.com/plugins/ru.mail.jira.plugins.groupeditfiedls and configure editable for reporter only.
Thanks, but this is only for version 5.2, we are using 5.0.7.
No, see here:
https://marketplace.atlassian.com/plugins/ru.mail.jira.plugins.groupeditfiedls/version/70
You don't need any plugins.
Look at your "screen scheme", in there, you'll find you can tell Jira to use different "screens" for Create, Edit and View. A screen is a list of fields to present to the user. Generally, most schemes use the same screen for everything, to keep it simple, but you can change this.
For your case, I would have two screens:
Screen 1: Has your select list on it somewhere. Use this for View and Create
Screen 2: Does NOT have your select list on it. Use this for Edit
You'll be able to populate a value when creating the issue, and then not change it later. One other thing to consider - workflows may have "transition screens" - you'll want to check if those screens have your field.
Thanks, I didn’t see this.
Looks like a useful plugin.
However I failed to mention that the field I'm talking about is the version list, so I don’t see how I can use this plugin in this case.
Thanks, I'm aware of this option.
However I want the users to see the value in the field in all screens. so removing it from other screens is not an option in this case. and this field also appears in transition screens.
This doesn't work for a select list.
It will work for all custom fields, we are using it. It works properly.
We ended up using this is the base for our script.
Thanks.
@prathighantam can you please eloborate in detail? Where to put the javascript code and how ?
You can put the java script on any field of your screen . In the field config of your project/issue type you add this script.
<script>
var editSubmit=document.getElementById('edit-issue-submit');
if(null!=editSubmit)
{
editSubmit.onclick=function()
fieldname.disabled=false;
}
</script>
Nope, not working ... I am using JIRA 5.2.2.
<script> var editSubmit=document.getElementById('edit-issue-submit'); var cfc_10404= document.getElementById('customfield_10404'); cfc_10404.disabled=true; if(null!=editSubmit) { editSubmit.onclick=function() { cfc_10404.disabled=false; } } </script>
Use the below snippet to enable the custom field, before the issue is created. This is using the native AJS.
<script type="text/javascript"> AJS.$( document ).ready(function() { AJS.$("#issue-create-submit").click(function(){ AJS.$("#customfield_XXXXX").attr("disabled",false); }); }); </script>
It looks like you're new here. Sign in or register to get started.