SOLVED: Checkboxes on multiple columns in Jira Edited

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

2 answers

1 accepted

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

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.

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

see screenshots in question as an example

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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jun 14, 2018 in Jira Service Desk

How the Telegram Integration for Jira helps Sergey's team take their support efficiency to the bank

...+ reading Fantasy). The same is true for him at the bank he works for: Efficiency is key when time literally equals money. Read on to learn how Sergey makes most of the time he has by...

491 views 2 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you