Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I am able to make a field readonly on create screen but the java script fails on transition screen!

SUNIL KUMAR CHINNAMGARI December 27, 2011

Hello,

I am a newbie to Jira. I have implemented a java script to make a field X readOnly in jira create screen and it works! I use the same script to make another custom field readOnly on a transition screen but it does not work! I have used a Velocity processed Message Custom Field (for edit) default value [to add the script] on transition screen to get the custom field set as readOnly on the transition screen. I can confirm the custom field ID is right. I am not sure where I am doing wrong here.

<script type="text/javascript">
window.onload=setFields;
function setFields()
{
var Fieldtoreadonly = document.getElementById("customfield_10103");
Fieldtoreadonly.readOnly=true;
}

</script>

By the way, The custom field I am trying to disable is a field that is capturing input from user on create screen and the tranisition exists on the view issue screen [Open To Closed]. Any help is grately appreciated.

Sunil

1 answer

0 votes
Hugh Prior
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 27, 2011

I don't think you should be using JavaScript to make the field read only, but should rather be using Field Configurations:

http://confluence.atlassian.com/display/JIRA/Specifying+Field+Behaviour

SUNIL KUMAR CHINNAMGARI December 28, 2011

Thanks Brussels but I wish I could set a field as readonly through field behaviour. Unfortunately, it is not the case as readOnly option is unavailable on Feild behaviour specifiyer so the need to use Java script.

Sunil

Suggest an answer

Log in or Sign up to answer