How to make checkboxes persistant in a table.

65 views
Skip to first unread message

Sapphireslinger

unread,
Jul 10, 2019, 11:36:16 PM7/10/19
to TiddlyWiki
I am trying to make a checkbox table to keep track of a habit. I really like that I can check a checkbox without opening the tiddler. (That way I can click on my sidebar tab marked "Habits" and go down through the list of transcluded tables checking off habits without opening a single tiddler.) However the checkboxes refuse to stay checked. What am I doing wrong? Here is my example table:

| JOURNAL |<|<|<|<|<|<|<|h
|W1|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|
|W2|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|
|W3|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|
|W4|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|
|W5|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|<input type="checkbox">|

Mark S.

unread,
Jul 10, 2019, 11:47:27 PM7/10/19
to TiddlyWiki
Use the checkbox widget (https://tiddlywiki.com/#CheckboxWidget) and, perhaps, set each box to a field in your tiddler. Something like:

<$checkbox field="w1-a" checked="done" unchecked="undone"/> ...
<$checkbox field="w1-b" checked="done" unchecked="undone"/>

etc.

The problem with this approach is that you will have to constantly add more fields as the weeks progress.

A different structure might put one week's worth of values in a single tiddler. Then use a list widget to loop and create your checkbox table. Then whenever
you need to create a new week, just clone an old one and reset the field values.

Good luck!
Message has been deleted

Sapphireslinger

unread,
Jul 11, 2019, 1:15:01 AM7/11/19
to TiddlyWiki
Thank you so much, Mark S.! It worked! I have the table in a tiddler titled "Checkbox Table Journal" which is transcluded in my Habits tiddler thus:


<$transclude tiddler="Checkbox Table Journal" mode="block"/>


I can check a box in this Journal table with the "Habits" tiddler unopened (in view mode) but showing in the story river, then save and close my whole TiddlyWiki, then reopen it and the box stays checked.


HOWEVER, when I click on my Sidebar tab labeled "Habits" and the content of my "Habits" tiddler drops down, I can see all my transcluded tables but they show as blank with no boxes checked, even while they show as checked in the unopened tiddler in the story river.


Furthermore, when I check a box in the Journal table showing in this tab drop-down state and then save my whole TiddlyWiki the box does not remain checked.


Would you know why this is so?

TonyM

unread,
Jul 11, 2019, 1:58:11 AM7/11/19
to TiddlyWiki
Sapphireslinger

The sideBar by definition does not have the currentTiddler value set. Either you can set it in that tiddler with the tiddlerWidget or when using a list to list tiddlers. 

Either that or you use tiddler= in the checkbox and other widgets where relevant.

Regards
Tony

Sapphireslinger

unread,
Jul 11, 2019, 11:46:23 AM7/11/19
to TiddlyWiki
@TonyM, your suggestion to use tiddler= in the table cell worked!

My tables can now display any checkmarks and be checked and unchecked directly in "sidebar tab dropdown mode"!

I did not understand what you meant by “and other w” though.

So far I have ended up with this 35-day (1 month) habit checkbox table (however so as not to drown everyone in code I am only pasting the first week below):

| JOURNAL |<|<|<|<|<|<|<|h
|W1|<$checkbox tiddler="Checkbox Table Journal" field="journal20190630" checked="done" unchecked="undone"/>|<$checkbox tiddler="Checkbox Table Journal" field="journal20190701" checked="done" unchecked="undone"/>|<$checkbox tiddler="Checkbox Table Journal" field="journal20190702" checked="done" unchecked="undone"/>|<$checkbox tiddler="Checkbox Table Journal" field="journal20190703" checked="done" unchecked="undone"/>|<$checkbox tiddler="Checkbox Table Journal" field="journal20190704" checked="done" unchecked="undone"/>|<$checkbox tiddler="Checkbox Table Journal" field="journal20190705" checked="done" unchecked="undone"/>|<$checkbox tiddler="Checkbox Table Journal" field="journal20190706" checked="done" unchecked="undone"/>|

@Mark S., So sorry, I do not know how to “use a list widget to loop and create your checkbox table”. I went to https://tiddlywiki.com/static/ListWidget.html, but still do not understand.

Also, I discovered I could not use "w1-a" etc for the field= because when I got done doing up 20+ other habit tables ("Rode Bike" "Read Book" etc) and transcluded them all into one tiddler, I discovered to my dismay that when I checkmarked, for example, the "w1-a" checkbox on one table, all the "w1-a" checkboxes on ALL the tables got checked. Checkmark one day on the journal table and the same day on all the tables got checked.

It was not enough to change the fields from "w1-a" etc to "journal1" through "journal35", "rodebike1" through "rodebike35", "readbook1" through "readbook35", because at the end of the month when I go to clone and archive, say, the journal table before resetting for a new month it will eventually be transcluded with all future journal tables in one tiddler (2019-07 journal table, 2019-08 journal table, 2019-09 journal table etc for example) and then the same problem will arise, there will be at least 3 checkboxes from 3 different tables sharing the same field "journal1" for example and my checkmarks will get all messed up and lost.

I renamed the checkbox fields "journal21090701" through "journal20190731" etc, so every checkbox in every journal table will have a unique identifier and never clash, but when it comes time to reset my habit tables every month I fear it will be very tedious. I will have to manually change the field for each of 35 checkboxes on 20+ habit tables.

It is almost enough to make one wish to go back to this as a template:

| COPY THIS FOR A NEW TABLE |<|<|<|<|<|<|<|h
|W1| | | | | | | |
|W2| | | | | | | |
|W3| | | | | | | |
|W4| | | | | | | |
|W5| | | | | | | |

I am still very grateful to have learned how to do it the other way though and will continue using this new way for as long as I can.

Thank you all for your help. It is my very first time to post on TiddlyWiki. I have been using it for about 2 months.
Reply all
Reply to author
Forward
0 new messages