Displaying a Field Based on Another Field Selection

Usage FAQ

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

Please note that adding Javascript to custom fields is a customisation and not maintained as a supported part of JIRA.

In Atlassian's support JIRA, when a user creates an issue with "Critical" priority, it will display the "Priority Explanation" field.

This can be achieved by performing the following steps:

  1. Create a "Free Text Field (unlimited text)" custom field type (Administration -> Issue Fields -> Custom Fields)
  2. Fill in the following text into the "Description" field:
    
    <script type="text/javascript">
      priority = document.getElementById('priority');
      if (priority) {
          target = document.getElementById('customfield_10000');
          // Hide the target field if priority isn't critical
          if (priority.value != 2) target.style.display='none';
     
          priority.onchange=function() {
              if (this.value == 2) {              
                         target.style.display = '';  
                         target.value="enter message here";
                      } else {
                     target.style.display='none';
              }
          }
      }
     </script>
    
  3. Make sure to change the custom field id and priority id. To find the custom field id, view the source of the page when viewing an issue, or check the URL when editing a custom field.
Last modified on Jul 20, 2011

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.