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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,774 views 11 18
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot