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/1252ada5-cfef-40c0-a903-6f794157fae9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.