Can't get checkbox actions / uncheckactions to work

126 views
Skip to first unread message

Mat

unread,
May 24, 2018, 5:53:27 AM5/24/18
to TiddlyWiki
I want to make settings of a tiddlers fields by means of checkboxes. 

(For those who're following the Backend project: This is part of that project. The idea is that the type-of-backend criteria is more of a first "road splitter" than the other criteria so I'll present it separately before the user enters the matrix. The following question is - technically - independent of the Backend project.)

It really should not be too difficult but I can't get it to work. In the actions and uncheckactions, I've tried every variant of subfilters and stuff I can think of but I'm doing something wrong. The user should be able to check multiple options. Here's the basic attempt:

\define chck(type)
<$checkbox
    tiddler
=requirements
    field
="criteria-type-of-backend"
   
checked="$type$"
   
unchecked=""
   
default=""
    actions
="""<$action-listops $tiddler=requirements $field="criteria-type-of-backend" $subfilter="$type$"/>"""
    uncheckactions
="""<$action-listops $tiddler=requirements $field="criteria-type-of-backend" $subfilter="-$type$"/>"""
>
$type$
</$checkbox>
\end

|<<chck Saver>>|Saving to common storage like local drive|
|<<chck Server>>|You host and fully control your data|
|<<chck Service>>|Someone else hosts and serves your wiki|
|<<chck Manager>>|Tool to manage multiple wikis "as objects"|

What am I doing wrong?

Thanks!

<:-)


TonyM

unread,
May 24, 2018, 7:10:12 AM5/24/18
to TiddlyWiki
Mat,

I tried this on my personal wiki and it creates the requirements tiddler and applies the values as I would expect.

If none is checked its blank, and when one is checked and you check another the value changes.

All working to my knowledge

Tony

Mat

unread,
May 24, 2018, 7:18:53 AM5/24/18
to TiddlyWiki
TonyM wrote:

If none is checked its blank, and when one is checked and you check another the value changes.

...are you saying it changes so that you get two checks, i.e two values into the field? Because that is the intention. One should be able to select both e.g "server" and "manager".

Thanks for looking.

<:-)

TonyM

unread,
May 24, 2018, 7:37:39 AM5/24/18
to TiddlyWiki
Mat,

No only one permitted at a time. This is a useful in itself but not what you are asking.

I will investigate but still find listops a little mysterious.

Regards
Tony

TonyM

unread,
May 24, 2018, 7:43:36 AM5/24/18
to TiddlyWiki
Post Script,

I believe what is happening is the checkbox widget if over riding the listops action with its default behaviour, It is responding to the unchecked condition and making the field blank.

Unfortunately removing the unchecked or default values make no difference

Have you thought of using the select widget with the multiple option?

Regards
Tony


On Thursday, May 24, 2018 at 9:18:53 PM UTC+10, Mat wrote:

TonyM

unread,
May 24, 2018, 7:49:31 AM5/24/18
to TiddlyWiki
Mat, Fixed it.

Delete the checkbox tiddler= falue so the checkbox values remain on current tiddler, one checkbox for each $type$, and similtaniously use the action to add and remove values from $tiddler=requirements $field="criteria-type-of-backend"


\define chck(type)
<$checkbox
    field
="$type$"
   
checked="$type$"

    actions
="""<$action-listops $tiddler=requirements $field="criteria-type-of-backend" $subfilter="$type$"/>"""
    uncheckactions
="""<$action-listops $tiddler=requirements $field="criteria-type-of-backend" $subfilter="-$type$"/>"""
>
$type$
</$checkbox>
\end


|<<chck Saver>>|Saving to common storage like local drive|
|<<chck Server>>|You host and fully control your data|
|<<chck Service>>|Someone else hosts and serves your wiki|
|<<chck Manager>>|Tool to manage multiple wikis "as objects"|


Regards
Tony


On Thursday, May 24, 2018 at 9:18:53 PM UTC+10, Mat wrote:

TonyM

unread,
May 24, 2018, 7:57:08 AM5/24/18
to TiddlyWiki
This is a a bit more usnderstanable

\define chck(type)
<$checkbox
    field
="$type$-checkbox"
   
checked="checked"
   
unchecked="unchecked"
    actions
="""<$action-listops $field="criteria-type-of-backend" $subfilter="$type$"/>"""
    uncheckactions
="""<$action-listops  $field="criteria-type-of-backend" $subfilter="-$type$"/>"""
>
$type$
</$checkbox>
\end


Tony

Mat

unread,
May 24, 2018, 8:30:00 AM5/24/18
to TiddlyWiki
Excellent! Thank you Tony!

<:-)

Reply all
Reply to author
Forward
0 new messages