Thank you  Eric Shulman, it works.

Op zondag 5 februari 2023 om 17:03:31 UTC+1 schreef Eric Shulman:

> Give this a try:
> ```
> \define checkbox-list(values,fieldname)
> <$list filter="[enlist[$values$]]" variable="thisValue" >
> <div><$checkbox listField="$fieldname$" checked=<<thisValue>>> 
> <<thisValue>></$checkbox></div>
> </$list>
> \end
> ```
> Notes:
> * If the `values` list has items that contain double quotes or square 
> brackets, those characters will interfere with the parsing of the `$list` 
> filter syntax.  To avoid this problem, instead of writing 
> `filter="[enlist[$values$]]"`, you can write: 
> `filter="[enlist<__values__>]"`.  see 
> https://tiddlywiki.com/#Macro%20Definitions%20in%20WikiText for more info.
> * Note also that, while brackets (square, angled, or curly) within 
> wikitext syntax are doubled, when used in filter syntax, they are SINGLE 
> (i.e., `[enlist<__values__>]`... NOT `[enlist<<__values__>>]`)
>
> enjoy,
> -e
> On Sunday, February 5, 2023 at 7:24:48 AM UTC-8 vinvi...@gmail.com wrote:
>
>> Hi, I'm trying to make a macro.
>>
>> This is my code so far:
>>
>> \define checkbox-list()<$list variable="LIST-FROM-FIELD" 
>> filter="[list[!!LIST-FROM-FIELD]]"><br><$checkbox listField="WRITE TO 
>> FIELD" checked=<<LIST-FROM-FIELD>>> <<LIST-FROM-FIELD>></$checkbox></$list>
>>
>> It now reads the values from a field and displays them with a checkbox in 
>> front of them. 
>> By checking the checkbox, the corresponding value is written to another 
>> field.
>>
>> I would prefer that when calling the macro I could determine which values 
>> should be displayed 
>> without having to put them in a field. 
>>
>> Something like:
>> <<checkbox-list "values to list" "Name-field-to-write-to">>
>>
>> I've been working on $myvar$. and enlist $mylist$.. I can't figure it out.
>>
>> Is there anyone who can help me with this?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/d03353d3-d0af-4c8c-8877-2fc14488f808n%40googlegroups.com.

Reply via email to