SOLVED: Checkboxes on multiple columns in Jira

Roberto Arnetoli September 23, 2017

Hi ,

I am trying show checkboxes on multiple columns in the create and edit forms of an issue using a script I found in a older question, but I am still unable to make it work.

The script that I am using is 

<script type="text/javascript">
(function($){
$(document).ready(function(){
$("input[name='customfield_10405']").parent().attr('style', 'float: left');
});
})(AJS.$);
</script>

and I am sure the customfield number is correct

Capture1.JPG

Yet, I am unable to make it work.

Capture2.JPG

Can anybody help?

I am using Jira Server v7.4.4

Thanks in advance

Roberto

6 answers

1 accepted

7 votes
Answer accepted
Roberto Arnetoli September 25, 2017

FINALLY!!

this is the JS to be added to the customfield description to have checkboxes on multiple columns

<script language="javascript">
AJS.$(document).ready(function(){
Array.from(document.body.getElementsByClassName("checkbox")).forEach(function (cbox) {
if (cbox.getAttribute('name')=='customfield_10405') {
cbox.parentNode.style.cssFloat='left';
cbox.parentNode.style.width='20%';
}
});
});
</script>

Capture.JPG

Ramesh Krishnamoorthy November 13, 2017

Hi Robert, can you please clarify where exactly the script has to be pasted? And, what about the double quotes in the script? Will they create problems during script eval? 

The above script is not working for me and it just gets added into a <p> tag in the page and doesn't get executed. Not sure what I am doing wrong.

Roberto Arnetoli November 16, 2017

You have to put it into the description of your custom field.

see screenshots in question as an example

Like Alena likes this
Sysad October 23, 2019

Hi @Roberto Arnetoli 

script works great on Jira and it looks as expected on create issue screen. However, do you have any idea how achive similar in the Jira service desk customer portal?

Like Ivan Torres-Candelaria likes this
Ivan Torres-Candelaria April 2, 2020

@Sysad did you find a way to pass this to the portal? Thanks

dorin gez April 28, 2021

@Roberto Arnetoli Hey, the script is causing the screens that contain this field to jam. Even through the settings I can not access it. What am I doing wrong? Thanks 

Steven Schouppe September 14, 2021

@Roberto Arnetoli Works great for me.

2 votes
Bill Galvin March 22, 2019

Can anyone tell me if this will work in Jira/Cloud?

1 vote
TJ November 11, 2019

Same for me.. does anyone knows how to make this work on Jira Cloud?

0 votes
Ivan Torres-Candelaria April 2, 2020

Hi! Any way to actually do this for the Customer Portal? 

0 votes
Laci February 3, 2020

So, visually this works great... however, by putting this script in, I can no longer bulk edit this field. Thoughts on how to make that possible without removing the script? Thanks!

0 votes
Roberto Arnetoli September 24, 2017

I have found that the following javascript or css applied to the create issue form source (using Fiddle) do exactly what I need:

var cbox = document.getElementsByClassName("checkbox");
for(var i = 0; i < cbox.length; i++) {
if (cbox.item(i).getAttribute('name')=='customfield_10405') {
cbox.item(i).style.cssFloat='left';
cbox.item(i).style.width='25%';
}
}
.checkbox[name=customfield_10405] { 
float: left;
width: 25%;
}

However, when I try to apply it to the Jira customfield, it does not work :-(

This is what I am adding to the customfield description:

<script language="javascript">
AJS.$(document).ready(function(){
var cbox = document.getElementsByClassName("checkbox");
for(var i = 0; i < cbox.length; i++) {
if (cbox.item(i).getAttribute('name')=='customfield_10405') {
cbox.item(i).style.cssFloat='left';
cbox.item(i).style.width='25%';
}
}
});
</script>

Any help on what to do?

thanks

Roberto Arnetoli September 24, 2017

I found that adding the following JS to the custom field description (replacing the for loop) has an effect on the right customfield, However it is still not doing what I need - it is actually moving the tickbox to the right and making it bigger but still in 1 column (see below).

What am I doing wrong?

<script language="javascript">
AJS.$(document).ready(function(){
Array.from(document.body.getElementsByClassName("checkbox")).forEach(function (cbox) {
if (cbox.getAttribute('name')=='customfield_10405') {
cbox.style.cssFloat='left';
cbox.style.width='50%';
}
});
});
</script>

Capture3.JPG

Suggest an answer

Log in or Sign up to answer