Templates with checkboxes and radio buttons

Is it possible to create templates in DEVONthink with checkboxes and radio buttons?

Checkboxes can be extremely useful if we want to analyze, classify and categorize certain objects according to types, genres and other attributes.

Here is a screenshot showing a simple (FileMaker Pro) template for analyzing folk tales. Folk tales usually belong to only one (literary) type. Therefore, using checkboxes, one can quickly categorize a folk tale with just one click of the mouse.

Markdown and formatted notes support only checkboxes (see Edit > Insert > Checkbox) but not radio buttons. Another possibility might be a sheet plus the form view (requires at least the Pro edition) using booleans and sets (although sets are shown as a popup, not as radio buttons).

I suppose that one could use radio boxes in both formats by adding them as raw HTML code. However, I do not see (yet?) how clicking on them will retain their state. If one has an HTML document with check/radio boxes, it should show their default state(s) whenever it’s opened anew.

In my mind, the only way to make the boxes retain state is by adding JavaScript to the process: an onclick event handler would then (re)set the checked property of the box(es). But maybe wrong here.

The rendering of Markdown documents doesn’t support this.

What exactly does it not support?

That the state of checkboxes or radio buttons can be changed and saved.

Ah. That’s what i thought.

I thought the state would be saved in a formatted note, but that appears to not be the case either. Is that expected, as I thought a formatted note saves the state?

Very much so, I’d say. A formatted note is just HTML. If someone clicks on a checkbox, the HTML itself is not modified, not even in a browser. So if you load the same formatted note/HTML document again, you’ll see it exactly as it was before you clicked on the check box.

That’s the Correct Behavior™

Perhaps it’s how it’s implemented but inserted checkboxes retain their state in formatted noted but @cgrunenberg would have to comment on that.

For a formatted note to save its state, it would have to change its own source code. For it to happen, DT would have to automagically save the DOM after every change. Which in turn would require either injecting some JavaScript code into the formatted note or use a framework/component that does The Right Thing™.

There’s a discussion on this here: https://www.reddit.com/r/learnjavascript/comments/pt1egp/is_it_possible_to_save_dom_manipulations_in/

Also, there’s usually no connection between the HTML renderer (aka WKWebView) and the HTML source. The renderer can do whatever it wants to its local copy of the HTML (and it does, for example when the user clicks on a checkbox), but it can’t change the source (aka the original). Which is Good™, because who’d want the source of their web pages modified by a browser?

Within Apple’s world, one could create a web archive from the current state of a document in a WKWebView. But that is happening asynchronously, so it might not be in sync with the document.

And then there’s the question of how to trigger this archiving function. While JavaScript can react to events like the change of a checkbox state, it can’t tell WKWebView to create an archive in that moment.

Thank you for describing how to create checkboxes in DEVONthink.

I’m looking for a way to export to a Rich Text file the value(s) that have been ticked in the checkboxes. Example: if I have the option to check a1, a2, a3, a4 and a5, and I have checked a4, then I want only a4 to be exported.


Using a sheet in the form view looks generally promising, but I encounter a problem when searching items I have ticked. Let’s say, I have a file with the booleans a1, a2, a3, a4 and a5, and I have only ticked a4; now, when I search for a2 DEVONthink will also find the file in which I only ticked a4. That is, it finds a2 ALTHOUGH I did NOT tick a2. This somehow defeats the purpose of ticking booleans

That works for checkboxes; the source code is changed
not for radio buttons

Sample checkbox code

<input type="checkbox" id="vehicle1" name="vehicle1" value="Bike" checked="checked">
<label for="vehicle1"> I have a bike</label><br>
<input type="checkbox" id="vehicle2" name="vehicle2" value="Car">
<label for="vehicle2"> I have a car</label><br>
<input type="checkbox" id="vehicle3" name="vehicle3" value="Boat">
<label for="vehicle3"> I have a boat</label><br>

Warning: DTTG does not display checkboxes or radio buttons

You could concoct some JavaScript writing the data to the Clipboard and then some other code to retrieve it from there and create an MD file.

But I suspect that you’re trying to use DT to solve a problem that it wasn’t meant to solve.

I’m not sure about the context here (and I can’t really play around with it because I don’t have DT on the machine I’m currently using, and DTTG does not seem to create checkboxes in formatted notes). And I can’t copy/paste raw HTML into DDTG as a formatted note either – so no luck right now

Anyway. Suppose you have
<input type="checkbox" id="cb1">
in your formatted note. You open the note, click on the checkbox, close the note, and then open it again – is the checkbox still selected?

Confirmed, the source code gets changed and the checkbox remains selected

Interesting. I’m wondering how they make that happen.
Thanks for checking!

After experimenting with Boolean for a while, I have now moved to the types Set and Single-line-Text which both provide me with a drop-down field. I entered the values






Now, is there any way to have more than one value at a time appearing in the field? For example, is it possible to have both “dog” and “cat” appear at the same time in the field, perhaps with a comma in between? If I choose “cat”, “dog” will disappear and vice versa.

Trying to facilitate literary analysis, I guess the best way in my case is to use FileMaker Pro (FMP) for the analysis. Then export the record with Tab-Separated Values and have Nisus Writer Pro automatically open the file in Finder and format it with a macro, all in one go. And finally, store the Rich Text file in DEVONthink. This already works like a charm.

When exporting fields with checkboxes in FMP only the values which have been chosen are exported, and that’s exactly what I need.

No you can’t choose more than one item in a set.