Also depending on the use case you can set the checkbox state to be stored in a field on the current or any tiddler, just choose a different fieldname for each. The selection then stays with the tiddler.
First, the checkbox state reflects some value stored somewhere. In you example, you’re setting a (data tiddler) index named as the current tiddler. If you set some other index in that same tiddler, then that should also work and be reflected in any checkbox that looks at that other index.
Thus when you say “But that means I can have only one checkbox in a tiddler.” it seems you refer to currentTiddler as the same tiddler each time. Instead, you can choose some other index. You can, for example, manually specify different indexes or you can include that whole checkbox construct in a listwidget so that currentTiddler is different for each loop.
BTW, I don’t think indexes in datatiddlers accept e.g capital letters. Not sure. For sure it will not accept any arbitrary characters (e.g :). You might consider having the checkbox set fields instead of indices.
Is there a way by which instead of passing an argument every time, some random string is used instead? It would be great if that random string is the current time in YYYY0MM0DD0hh0mm0ssxxx format. Then, we can have:
@sull-vitsy Thanks. And I am really sorry if my questions are too naive.
I do not need the ‘exact’ time. I was using exact time to concatenate the tiddler name to avoid any chance of having the same index — I am unlikely to be able to add text or click that fast
Plus, merely looking at the index, one can figure out from where and when it has come. So, for readability, it would be better to use “YYYY-0MM-0DD 0hh:0mm:0ss xxx” format for the now widget.
On a related note, will the index value change when I uncheck the box?
What actually are you trying to achieve in the end? It seems that the checkbox values you want to set are only to be used to reflect the state of the checkbox and that this checkbox is only to be seen in one place (because the only thing to identify the checkbox with would be via the random value you attempt to create), is that right?
Anyway, this:
…doesn’t work because it breaks several syntax rules. I’m not sure the following will work but it is at least a bit of an improvement:
Absolutely. That is what I want to achieve. I will take a minute of yours to tell you how I am planning to use it.
I have a tiddler called QuickTasks. I use it to capture several tasks that will take hardly any time to complete. But I do not want to do them now. These are transient in nature. But may crop up again after a few days. A good example is ‘Replace batteries’.
I will just copy paste the checkbox line and edit the ‘Replace Batteries’ part. When I complete a task, I do not need to edit the tiddler. I just check that box and be done. Later on, when I have time, I will delete the lines I do not need from QuickTasks tiddler.
I know, as a workflow, it is clumsy. But this seems to work right now for me.
Hope I am clear. Please ask if something is unclear.
I know this isn’t related to your question, but there are some cool plugins for task management and quick tasks. See Todolist which is a simple todolist maker. You call a macro, you add tasks, you tick off checkboxes.
Projectify leans more towards project management, but it has a quick-add todo function. You just press alt+c from anywhere in your wiki and it’ll open an inbox tiddler where you can add tasks quickly.
@twMat Thank you so much. Yes. It does. The ExampleData tiddler does carry an index properly named.
But this also means that as soon as it is checked. the box gets unchecked. Time moves on. 20211006141516789 becomes 20211006141516790. So, the checkbox attached to ‘Replace Batteries’ now has a new value that is not in the index. So, it is set to default - unchecked.
OK, so one idea might be to not name the indices with the time stamp but instead a slugified version of the very item that you check/uncheck. I.e “Replace batteries” would become “replace-batteries”. There is the slugify operator for this.