How do I create two fields at once with one radio button?

197 views
Skip to first unread message

Måns

unread,
Jun 9, 2016, 6:05:43 PM6/9/16
to TiddlyWiki
Hi TwWizards

With this code I can create one field with a radio button:
<$radio field="gender" value="him"> male</$radio>

How do I make it create two fields at once?

This doesn't work:
<$radio field="gender" value="he" field="gender2" value="him"> male</$radio>

I remember that @matabele made a couple of plugins that would enable creating a lot of things all at once - but I don't think it worked with radio buttons.
Please correct med if I'm wrong.

Cheers Måns Mårtensson

Birthe C

unread,
Jun 9, 2016, 6:39:34 PM6/9/16
to TiddlyWiki

Måns

unread,
Jun 10, 2016, 5:03:18 AM6/10/16
to TiddlyWiki
Thank you very much Birthe :-)

I had completely forgotten that I asked this question a long time ago - and that Matabele gave me a great solution using data sets...
Sorry Matabele ... and thank you both .).

Cheers Måns Mårtensson

Måns

unread,
Jun 10, 2016, 8:53:36 AM6/10/16
to TiddlyWiki
Hi again

I need to be able to toggle a gender field in a "student card". Male or female - and I need to setup a way for my users (collegues) to create sentences where they can add up to 4 variations of gender i.e.: 
"Gender is a good student". or: 
"When gender is doing gender's homework, gender is ...." (in Danish there is no difference when spelling he or hi(s)) 
I need variations on gender like: he, He, him and Him - she, She, her and Her.

I guess that a solution might be to let the radio button toggle between m and w for !!gender and create a data dictionary tiddler which has the variations like this:
KODE: VÆLG ALT
m1:he
m2:He
m3:him
m4:Him
m5:his
m6.His
k1:she
k2:She
k3:her
k4:Her


Next step might be to create a macrotemplate titled: "mw", which concatenates different parts like this: 
\define mw(var)
{{!!gender}}$var$##DataDictionaryTiddlerName
\end
<$ macrocall name="mw" var="1"/>

Usage: <<mw 1>> or just {{mw}} for he or she and <<mw 2>> for He or She and <<mw 3>> for him or her and <<mw 4>> for Him or Her (the 5'th variation isn't needed in Danish...)

Does this seem to be a good solution? - is it even possible?

Cheers Måns Mårtensson

Mat

unread,
Jun 10, 2016, 9:46:59 AM6/10/16
to TiddlyWiki
Måns, great to see you on the boards again.

In case it hasn't been mentioned; you can make a regular button look like a radio button (even just use images) and within that regular button you can have two setfield widgets. It would take you less than 10 minutes to make.

<:-)

Måns

unread,
Jun 10, 2016, 10:19:01 AM6/10/16
to TiddlyWiki
Hi Mat

Thank you. 
Please enlighten me :-)
Has anyone done this yet?
I've searched for "make a button look like a radio button" and "make a button behave like a radio button ".
No luck - or the information is hidden in some profound discussion about how to do something completely different?

Cheers Måns Mårtensson

Mat

unread,
Jun 10, 2016, 11:05:43 AM6/10/16
to TiddlyWiki
<$button class="tc-btn-invisible" >
⦿ ⦾ ⌾ ◉
</$button>

<:-)

BJ

unread,
Jun 10, 2016, 11:08:55 AM6/10/16
to TiddlyWiki

Matabele

unread,
Jun 11, 2016, 1:04:28 AM6/11/16
to TiddlyWiki
Hi Mans

Here's code fro a fake checkbox:
-- set (can have multiple action widgets)
<$reveal type="match" state="!!temp" text="set">
<$button set="!!temp" setTo="reset" class='tc-btn-invisible'>
<$action-listops $tiddler="test" $field="myfield" $filter="[my[filter]"/>
...
<input type=checkbox/>Set</$button>Set</$reveal>

 
-- reset
<$reveal type="match" state="!!temp" text="reset">
<$button set="!!temp" setTo="set" class='tc-btn-invisible'>
<$action-listops $tiddler="test" $field="myfield" $filter="[[]]"/>
...
<input type=checkbox checked/>Reset</$button>Reset</$reveal>

This may be modified to make a fake radio button -- 'input type = radio', as far as I recall

regards

Måns

unread,
Jun 11, 2016, 1:31:49 PM6/11/16
to TiddlyWiki
Hi Matabele

Thanks a lot :-)

I had to set it up with three states one with text="" another with text="female" and a third with text="male".
You are absolutely right in assuming that type="radio works,
It's a great hack :-)

Cheers Måns
Reply all
Reply to author
Forward
0 new messages