Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is there a button to reset all check boxes in a task list?

I set up a tasklist with checkboxes that I would like to re-use.

It is inconvenient to have to uncheck each one - one at a time - when I want to reuse my page.  Is there a way I can make a button to reset all checkboxes?

5 answers

Sorry to necro this question but I have been looking for a solution to this for a while and have given up and writen a user macro to provide this functionality.

 

The code is available here

Hi Lee! How can I get your javascript user macro enabled in my Confluence wiki page?

I appreciate your help.

Thank you a lot!

You need to be a confluence admin.
Then you can define new user macros at Admin > Configuration > User Macros.
That is where you can paste the code provided.

Once that's saved, as a user:

You add the user macro on the page. It renders a button you can click on.

Hi Robert,

I'm afraid this is currently not possible, but I've created a feature request for this at https://jira.atlassian.com/browse/CONF-37184. Please feel free to watch it to track its progress, as well as commenting and voting for it.

Regards,

Gustavo Refosco

This is what worked best for me and my needs based on @Lee Cannon 's code found here : 

 

{HTML Macro Start}

<button>onclick="untick()">Clear List</button>
<div id="taskList"> 

{HTML Macro End}

[ ] Task-1
[ ] Task-2
[ ] Task-3

{HTML Macro Start}

</div>
<script type="text/javascript">

function untick() {

var list = document.getElementById('taskList');
var base_url = window.location.protocol + "//" + window.location.host
var token = document.getElementById("atlassian-token").getAttribute("content")
var tasklist_id = list.getElementsByClassName("inline-task-list")[0].dataset.inlineTasksContentId;
var boxes = list.getElementsByClassName("checked");
var number_of_boxes = boxes.length;
var completed_boxes = 0;

for (i = number_of_boxes-1; i >= 0; i--) {
var task_id = boxes[i].dataset.inlineTaskId;
var xhttp = new XMLHttpRequest();
var url = base_url + "/rest/inlinetasks/1/task/" + tasklist_id + "/" + task_id + "/" xhttp.open("POST", url, true);
xhttp.setRequestHeader("Content-type", "application/json");
xhttp.send('{"trigger": "VIEW_PAGE", "status": "UNCHECKED"}');
boxes[i].className = "";
}
}

</script>

{HTML Macro End}

 

- I ignored the request's response because I don't really care if it fails in my case (it never did.)

- I added a <div id="x"></div> around the tasks to limit my search range and avoid modifying other tasks.

- I removed the location.reload() to avoid reload blink and replaced it with a className = "" to remove the "checked" class.

 

Hope this helps!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

408 views 23 8
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you