request extension to checkbox widget to support adding/deleting multiple keywords per field

177 views
Skip to first unread message

steve

unread,
Feb 24, 2020, 4:08:43 PM2/24/20
to TiddlyWiki
I would like to request an extension of the checkbox widget to support adding/deleting multiple, not mutually exclusive, keyword per field as opposed to turning a single keyword on or off.

But first, some background (apologies for excessive length).

I've developed a wiki that aims to make it simple to manipulate and view keywords in fields. My use case is a "roadmap" wiki I built with TW5 that I use to keep track of contacts, events, inventory and notes.

For example, the tiddler [[xkcd]] represents a link to the webcomic XKCD using keywords in six fields: infotype, rating, scope, source, subject and title.

FIGURE-1 (below) shows a tabular view of the [[xkcd]] tiddler with each row below the header showing the field name followed by the keywords for the field. Note that each field has a distinctive style for displaying the keywords, e.g., the subject keywords have a mint green background with black font.

FIGURE-2 (below) shows a banner view of the [[xkcd]] tiddler where the keywords are show in a row (without fieldnames) using the same keyword styles as FIGURE-1.

FIGURE-3 (below) show the editor view for the [[xkcd]] tiddler showing each field in a separate row. The keyword fields use checkboxes to add or remove keywords (e.g., the subject field) and the free text fields use an edit box to add/edit/delete text.

I consider this approach to offer several strengths:

* fields can contain multiple keywords;
* can add or delete keywords by clicking/unclicking a checkbox;
* harder to misspell or add an invalid keyword;
* can use colors to distinguish families of related keywords, e.g., the contact, event, inventory and note keyword families in the infotype field;
* can validate keywords or flag missing keywords on a per field basis (harder to do with tags);
* can view the fields and content without having to edit the tiddler;
* the banner format offers a compact view of tiddler titles and field content, e.g., FIGURE-4 (below).


I wrote a macro to support checkbox editing of keywords (i.e., add or delete a keyword by clicking the checkbox) by using CheckboxWidget in "Tag Mode" with a complicated manipulation of keywords, tags, and state tiddlers. It uses a "state tiddler" in the background (with defined actions and uncheckactions that use action-listops) where keywords are copied to tags in order to use the checkbox capability.

This leads to a proliferation of otherwise unnecessary state tiddlers which could be avoided if the keywords could be manipulated directly, i.e., add keyword to field if checkbox is checked or delete keyword from field if unchecked.

How? I am sure this is much easier said than done. Maybe add a "keyword mode" something like:

```<$checkbox field="infotype" keyword="contact"> ```

Thanks

Mark S.

unread,
Feb 24, 2020, 4:32:53 PM2/24/20
to TiddlyWiki
I may not be understanding what you're doing, since you haven't presented the tiddler-level view of your data.

But it seems like you can do something like this by having fields like "infotype" be list fields (at the tiddler level).

The checkbox widget has action clauses for clicking and unclicking. You can use the action-listops widget to
add or remove items from list fields.

Mat

unread,
Feb 24, 2020, 5:22:45 PM2/24/20
to TiddlyWiki

TonyM

unread,
Feb 24, 2020, 5:28:17 PM2/24/20
to TiddlyWiki
Steve,

Some quick feedback, If faced with this requirement I would suggest looking at marios gentags or alternative tag plugin  I would then look at cloning the process for the tagpill handling to include your checkbox. All of this can be achieved with some additional design, but I would not manipulate the existing tag process until the full consequences are known. 

What comes to mind in the extended list ops functions

Best wishes
Tony

PMario

unread,
Feb 24, 2020, 7:14:43 PM2/24/20
to TiddlyWiki
On Monday, February 24, 2020 at 10:08:43 PM UTC+1, steve wrote:
...
This leads to a proliferation of otherwise unnecessary state tiddlers which could be avoided if the keywords could be manipulated directly, i.e., add keyword to field if checkbox is checked or delete keyword from field if unchecked.

How? I am sure this is much easier said than done. Maybe add a "keyword mode" something like:

I think, there is a problem with the checkactions and uncheckactions handling in the widget. It seems to activate "check" and "uncheck" actions if the widget is unchecked. .. I'm not 100% sure. ... yet.

I will investigate

-m

Mohammad

unread,
Feb 24, 2020, 11:03:33 PM2/24/20
to tiddl...@googlegroups.com
Hi Mat,
 I see how you have used append with titles have space in their title!
 This is an example relevant to my recent question on how use append!
Thank you for this practical case!
--Mohammad

steve

unread,
Feb 25, 2020, 8:26:27 AM2/25/20
to TiddlyWiki

Here is the tiddler-level view of the data.

steve

unread,
Feb 25, 2020, 11:40:57 AM2/25/20
to TiddlyWiki

Hi Again

Mark S: I am treating the field as a list and using listops to add/remove keywords as you noted in your response. Also I posted a tiddler-level view (ie. edit view) above.

Mat: The toggle-in-field capability you suggested appears to provide the functionality I was looking for as does the feature cited by Mat (https://github.com/Jermolene/TiddlyWiki5/issues/1957).

TonyM: My current solution meets my requirement of adding/removing keywords via checkbox, the problem is that I have to use tags with a state tiddler in order to do it.  Rather than changing the "tag mode" of checkbox I was thinking more along the lines of augmenting the "field mode".

PMario: I am not seeing the problem with there is a problem with checkactions and uncheckactions in my implementation.

Thanks to all that responded.

Steve W


steve

unread,
Feb 25, 2020, 12:01:54 PM2/25/20
to TiddlyWiki
Hi

Suggestion for a "list mode" for checkbox widget.

<checkbox field="status" tag="closed" mode="list">

 * shows checkbox as checked if field contains the tag, unchecked otherwise;
 * appends tag to field when box is checked;
 * removes tag from field when box is unchecked;
 * does NOT default to text if field not provided;
 * filter field content using current regex or search filter operators;
 * alternatively filter content using tag:fieldName[tag] construct (default is to used the tag field);


Steve W

Mark S.

unread,
Feb 25, 2020, 12:08:57 PM2/25/20
to TiddlyWiki
Here's a simplified example of how this works. In reality, you would want to put all the code in
"My Infopanel Item 1" into it's own template based on a tag like "infopanel".

You can check and uncheck items and they are appended or removed appropriately.

There is a "Master" template that contains all possible complete lists. You can add new categories here.

Things you might want to note or change:

My example only shows subject and infotype. It's easy to add new categories. You might eventually want to populate this from Master, either by
collecting all fields or using a list field for top level categories.

There is a "hidden" field "check" that gets added and removed from the tiddler as you work. This saves having a ton of configuration tiddlers out there.

Checked and unchecked items are separate and not alphabetized together. It would probably take a more complicated paradigm to run them together.

HTH
checkboxes-per-category.json

steve

unread,
Feb 25, 2020, 2:00:26 PM2/25/20
to TiddlyWiki
Mark S.:

Thanks - I imported the json and see (I think) how you addressed the background configuration items to make it work. The current editor (see below) has a relatively small number of configuration items which may be straightforward to a developer but less to an end user.


Using the infotype field (see figure above) as an example the configuration info required is:

* list of keyword families per field; for infotype the keyword families are (contact, event, inventory, note);
* list of keywords per family; eg the contact family has keywords (acct bill blog govt help license service store subscription tbd);
* the colors per keyword family; for the contact family the colors are (background-color: darkseagreen;color: black;)
* the list of valid keywords per field; for infotype the valids are derived by concatenating the keywords from each family;
* the configuration information is kept in two tiddlers: configRoadmap.keywordFamilies and configRoadmap.keywordsPerField

FWIW this configuration enables a number of editor features:

* keywords for a field can be displayed as a relatively compact list;
* colors can be used to distinguish the different keyword families;
* keyword families can be expanded or shrunk; in the infotype field the contact family is expanded; and the event, inventory and note families are shrunk;
* invalid keywords such as zerg in the infotype field can be highlighted;

Thanks Again

Steve W.


bimlas

unread,
Feb 25, 2020, 3:33:45 PM2/25/20
to TiddlyWiki
steve,

You may be interested in this plugin: https://bimlas.gitlab.io/tw5-locator/ (Google Groups discussion: https://groups.google.com/forum/#!topic/tiddlywiki/Y6tbO_vnKmw)

Dropping the title (link) of a tiddler (without opening it in edit mode) on any field values listed in the Fields sidebar adds the field value to the tiddler (https://bimlas.gitlab.io/tw5-locator/#Walk-through -> Assign field values to tiddlers by drag and drop). Since you use many fields, field value search can be useful for you (https://bimlas.gitlab.io/tw5-locator/#Walk-through -> Narrow list of search results, search for field values). See the screencast in https://bimlas.gitlab.io/tw5-locator/#README for an overview.

I plan that all fields in edit mode work just like tags, so when you start typing a field value, you will see an autocompletion with the values you entered earlier. Before I do this, I need to finish the documentation, which I don't know exactly when I'm going to do it (the "Walk-through" is incomplete, read the other parts of the https://bimlas.gitlab.io/tw5-locator/#Tutorial if you are interested in the plugin).


steve

unread,
Feb 26, 2020, 7:31:18 AM2/26/20
to TiddlyWiki
bimlas:

I'll take a look - Thanks

Steve W

steve

unread,
Feb 26, 2020, 1:29:43 PM2/26/20
to TiddlyWiki
Mat:

I modified my editor to use a modified version of toggle-in-field (see figure below).

The modifications were:
* display the item/label as text (instead of a link);
* added a labelStyle to apply an optional style to the text (e.g., bold and all-caps in the example below);

No more having to create state tiddlers for editing - yay!

Thanks

Steve W


Reply all
Reply to author
Forward
0 new messages