How to hide the option "None" from Select List (Single and multiple choice) and Radio Buttons custom fields
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Sometimes users want to remove the "None" option from custom fields that appears by default with JIra Select List and Radio Buttons custom fields. When a custom field type of Select List or Radio Buttons is made mandatory from field configuration, the "None" option can be redundant in some cases.
Solution
Jira provides a "None" option with Select List and Radio Buttons custom field types that appears on the Screens. This helps in preventing the accidental submission of default or wrong values. The "None" Option can be removed from the Screens by modifying the field configuration for a specific custom field.
The below solutions will work only if "Enable HTML in field descriptions and list item values" is ON. This is a global setting and it is disabled by default due to the risk of Cross-site scripting. More details on this can be found with JRASERVER-70859 - Disallow HTML in custom field descriptions and list item values by default
For Select List Custom fields (Single and Multiple choice)
Open the field configuration for the project and issue type
Search the field whose "None" option you want to remove
Click on Edit inline with the field row
Add the below code (replace XXXXX with the actual custom field ID)
1 2 3 4 5 6 7 8 9 10 11
<script type='text/javascript'> JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) { hideNone(); }); AJS.$(document).ready(function () { hideNone(); }); function hideNone(){ AJS.$("#customfield_XXXXX option[value='-1']").remove(); } </script>
Update
For Radio Buttons Custom fields
Open the field configuration for the project and issue type
Search the field whose "None" option you want to remove
Click on Edit inline with the field row
Add the below code (replace XXXXX with the actual custom field ID)
1 2 3 4 5 6 7 8 9 10 11
<script type='text/javascript'> JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) { hideNone(); }); AJS.$(document).ready(function () { hideNone(); }); function hideNone(){ AJS.$("label[for='cf-customfield_XXXXX'").remove() } </script>
Update
It is possible that the screen is customised through other means and these scripts may not work as expected.
As these steps manipulate the underlying HTML, they will affect all projects sharing the configuration. It is possible to see the same behavior even after removing the code as it might be cached to the browser.
JavaScript support is outside Atlassian's support offerings. Please use this at your own discretion.
Was this helpful?