[TW5] Checkbox - disable last uncheck

70 views
Skip to first unread message

Mal

unread,
Dec 27, 2018, 12:22:17 AM12/27/18
to tiddl...@googlegroups.com
Hi All,

I have a list of tiddlers tagged with category1, category2 or category3 and I would like to filter the list based on checkboxes created using:

<$checkbox tiddler="category1" tag="show">Category 1</$checkbox>
<$checkbox tiddler="category2" tag="show">
Category 2</$checkbox>
<$checkbox tiddler="category3" tag="show">
Category 3</$checkbox>

However, I need at least one of the checkboxes selected.  In fact, if all three are unchecked, my subsequent list filters fail with an error message.

Is there any way I can ensure that there is always one of the checkboxes in the checked state?

I've looked at a few options involving filters to detect when there is just one category selected and appropriate action widgets, but I'm not clear about how to trigger an action widget without a button.

I guess I could use a select widget instead, with just the legal combinations listed, but seems a bit untidy.

Any suggestions appreciated.

Regards,

Mal

TonyM

unread,
Dec 27, 2018, 12:37:53 AM12/27/18
to TiddlyWiki
Mal,

The option you ask for is represented differently, what you seem to be looking for is "radio" options. See this https://tiddlywiki.com/#RadioWidget

It operates on a field rather than using tags, but you can search for these using the has and get operators or fieldname[value]

Regards
Tony

Mal

unread,
Dec 27, 2018, 1:17:33 AM12/27/18
to TiddlyWiki
Hi Tony,

I thought about using radio buttons, but I need any combination of the three categories (other than all off). As far as I can see I can only have one of the radio buttons on at any time, unless I'm missing something.

Regards,

Mal

TonyM

unread,
Dec 27, 2018, 1:59:06 AM12/27/18
to TiddlyWiki
Mal,

Sorry I missread your question. It is an unusual requirement. I have a hunch, but not the time to work through it now.

Perhaps you could build three/six buttons to toggle each value, using reveal to show/hide like a toggle, each could include a test for the others settings and set a field/tag using an action widget in the button body.

Also sometimes you can share state tiddlers between widgets to get special related settings.

The simplest would be to display a message if none are selected asking for at least one to be selected.

Personaly I use categories for one value (of a number) and subjects for zero or more.

I have another idea, I may write about later, basicaly calling a macro with a filter that lists the possible options and imposes the logic.

Regards
Tony

TonyM

unread,
Dec 27, 2018, 2:00:30 AM12/27/18
to TiddlyWiki
Post script

Perhaps you should fix this

However, it makes no sense to have all three checkboxes unchecked and this actually causes errors in my list filters.

Regards
Tony

Mal

unread,
Dec 27, 2018, 2:26:22 AM12/27/18
to TiddlyWiki
Tony,

I edited the original post to try to make it a bit clearer.

However, on reflection, I think it's probably too complicated to force the behaviour I'm looking for with either check boxes or radio buttons.  Instead, I will modify the subsequent filters to fail gracefully and produce sensible output if no categories are selected.

Thanks for your input on this.

Regards,

Mal
Reply all
Reply to author
Forward
0 new messages