On Thursday, July 21, 2016 at 6:58:39 AM UTC-7, Carlos Caimi wrote:
I'm try to make a simple avaliation ("evaluation" ???) form using a macro to create radios for awnser ("ANSWER") and <$reveal> to show the correct awnser for the student. But dont work.
However, to specify the target of a radio button, you must specify the *tiddler* and *field* separately. Something like this will work:
<$radio tiddler="$:/state/q/$quest$" field="text" value="a">A</$radio>
(note: the *field* name will default to "text" if not provided)
You will also need to change your debugging output from
to
Then, the rest of your script will work as you intend:
\define q(quest: "q1" answer: "b")
"""
<$radio tiddler="$:/state/q/$quest$" value="a">A</$radio>
<$radio tiddler="$:/state/q/$quest$" value="b">B</$radio>
<$radio tiddler="$:/state/q/$quest$" value="c">C</$radio>
<$radio tiddler="$:/state/q/$quest$" value="d">D</$radio>
<$radio tiddler="$:/state/q/$quest$" value="e">E</$radio>
"""
debug: quest: ''$quest$''; correctAnswer: ''$answer$''; answer: ''{{$:/state/q/$quest$}}''
<$reveal type="match" state="$:/state/q/$quest$" text="$answer$">
CORRECT!!
</$reveal>
<$reveal type="nomatch" state="$:/state/q/$quest$" text="$answer$">
WRONG!!
</$reveal>
\end
<<q "q1" "c">>
(note: I corrected your spelling of "answer")
enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
InsideTiddlyWiki: The Missing Manuals