Skip to end of banner
Go to start of banner

Making child fields read-only

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Sometimes you may want to make the database child information fields read-only. Here's a simple way of doing it, using javascript injection into the custom field's description:

You should add the following javascript code into the dbcf child field description from the field’s configuration:

<script type="text/javascript">
AJS.$('#customfield_10014').attr('readOnly', true);

//the following code is for inline edit only
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e, context, reason) {
    if(reason == JIRA.CONTENT_ADDED_REASON.inlineEditStarted) {
       AJS.$('#customfield_10014', context).attr('readOnly', true);
    }
});
</script>

,where customfield_xxxxx is the the id of your dbcf child custom field. You can see the cf id as parameter in the URL when editing its configuration (eg  '.../secure/admin/EditCustomField!default.jspa?id=10701'):

That's it. Your database child field will now be read-only on all screens.

  • No labels