\define nullr(testname)<$action-setfield $tiddler=<<currentTiddler>> $field="$testname$.right" $value="0" />\end\define nulll(testname)<$action-setfield $tiddler=<<currentTiddler>> $field="$testname$.left" $value="0" />\end
\define rorlcheck(testname)R<$checkbox tiddler="""$(currentTiddler)$""" field="$testname$.right" checked="1" unchecked="0" actions="<<nulll '$testname$'>>" >L<$checkbox tiddler="""$(currentTiddler)$""" field="$testname$.left" checked="1" unchecked="0" actions="<<nullr '$testname$'>>">\end
<<rorlcheck test>>So ... you want to be able to check either box, and automatically CLEAR the other box. And at no point could it be left AND right because then your patient would be speaking with forked tongue.
Right?
But if I decided I was being dyslexic and want to change my mind and say its deviating to the L, checking that would uncheck the R one
--
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+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
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/06f6b128-0af2-4019-9899-c25233749d00%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
\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>>\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}}