Checkboxes based on is blank or not is blank?

With the introduction of flexible fieldnames in 5.2.0 we can use the following with actual tiddler titles used as the fieldname.

<$checkbox field="fieldname" checked="true" unchecked="" default=""></$checkbox>

In the above the checkbox will toggle between true and empty.

Question:
I would like the check box to respond as true if it contains true or any other values, just not empty.
Can anyone see how to do this with minimal changes?

Maybe

<$checkbox field="fieldname" checked={{{[{!!fieldname}trim[]!is[blank]then{!!fieldname}else[true]]}}} unchecked="" 
default=""   >My test</$checkbox>

Dang it, you beat me to the punch. I didn’t think of trimming.

<$checkbox field="fieldname" checked={{{ [{!!fieldname}!is[blank]] [[true]] +[first[]] }}} unchecked="" default=""></$checkbox>
1 Like

Thanks I will test these soon, they both look good,

Marks comparison with the actual field value and Charlies choose the “first[]” are great ideas.

Thanks heaps, tony