Yes, my question was answered (the answer was "check your version first!") 
but thank you for providing this - it gives me more options for other 
similar needs I anticipate having in the near future!

On Tuesday, June 26, 2018 at 6:10:25 AM UTC-6, Jed Carty wrote:
>
> Did you get a solution to this? It sounds like you did but I don't see it 
> in the thread. If you did just ignore this. If not here are two solutions 
> depending on how you want it to work.
>
> Very simple, result in just one field:
>
> \define tristateCheck(field:output option1:Left option2:Right)
> <$checkbox field="""$field$""" checked="""option1""" unchecked=''>
> $option1$</$checkbox>
> <$checkbox field="""$field$""" checked="""option2""" 
> unchecked=''>$option2$</$checkbox>
> \end
>
>
> <<tristateCheck>>
>
> this version is a macro that is more complex but I think it more closely 
> fits what you are asking for (put it in a tiddler tagged with $:/tags/Macro 
> and then you can reuse it):
>
> \define clear(field value:'') '<$action-setfield $field="""$field$""" 
> $value="""$value$"""/>'
> \define ExclusiveCheckbox(tiddler field1 field2 option1 option2 
> emptyValue:"")
> <$tiddler tiddler="""$tiddler$""">
> <$checkbox field="""$field1$""" checked="""$option1$""" 
> unchecked="""$emptyValue$""" actions=<<clear """$field2$""" 
> """$emptyValue$""">>>$option1$</$checkbox>
>
> <$checkbox field="""$field2$""" checked="""$option2$""" 
> unchecked="""$emptyValue$""" actions=<<clear """$field1$""" 
> """$emptyValue$""">>>$option2$</$checkbox>
> </$tiddler>
> \end
>
> ! ExclusiveCheckbox macro
>
> This macro gives two checkboxes that can act similarly to radio buttons in 
> that only one will ever be checked at a time.
> The differences are that with this you can unchecked the checked option 
> and have none checked. You can also use this to have each checkbox affect a 
> separate field.
>
> |!Parameter |!Description |
> |!tiddler |The tiddler that contains the fields that are affected by the 
> checkboxes. |
> |!field1 |The field set by the first checkbox. |
> |!field2 |The field set by the second checkbox. |
> |!value1 |The value put into `field1` when the first checkbox is checked. |
> |!value2 |The value put into `field2` when the second checkbox is checked. 
> |
> |!emptyValue |The value that is put into a cleared field. |
>
> Example: `<<ExclusiveCheckbox "$:/temp/testTid" field1 field2 yes no 
> empty>>`
>
> <<ExclusiveCheckbox "$:/temp/testTid" field1 field2 yes no empty>>
>
> field1: {{$:/temp/testTid!!field1}}
>
> field2: {{$:/temp/testTid!!field2}}
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/f43c4739-efce-4554-adcd-03974da293b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to