Simple avaliation form

70 views
Skip to first unread message

Carlos Caimi

unread,
Jul 21, 2016, 9:58:39 AM7/21/16
to TiddlyWiki
Hello! 
I'm try to make a simple avaliation form using a macro to create radios for awnser and <$reveal> to show the correct awnser for the student. 
But dont work.

My code:

\define q(quest: "q1" awnser: "b")
"""
<$radio field="
$:/state/q/$quest$" value="a">A</$radio>
<$radio field="
$:/state/q/$quest$" value="b">B</$radio>
<$radio field="
$:/state/q/$quest$" value="c">C</$radio>
<$radio field="
$:/state/q/$quest$" value="d">D</$radio>
<$radio field="
$:/state/q/$quest$" value="e">E</$radio>
"""


debug
: quest: ''$quest$''; correctAwnser: ''$awnser$''; awnser: ''{{!!$:/state/q/$quest$}}''

<$reveal type="match" state="$:/state/q/$quest$" text=$awnser$>
   CORRECT
!!
</$reveal>

<$reveal type="nomatch" state="$:/
state/q/$quest$" text=$awnser$>
   WRONG!!
</$reveal>
\end

I call my macro:

<<q "q1" "c">>

The <$reveal> dont match anything. Always WRONG

plz helpme

p.s: exists a better form to do this?

tks a lot

Eric Shulman

unread,
Jul 21, 2016, 12:48:03 PM7/21/16
to TiddlyWiki
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.

In your code, you write: 
<$radio field="$:/state/q/$quest$" value="a">A</$radio>

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
{{!!$:/state/q/$quest$}}
to
{{$:/state/q/$quest$}}

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

Carlos Caimi

unread,
Jul 21, 2016, 1:33:52 PM7/21/16
to TiddlyWiki
\o/

tks Eric,
for correcting my code
...and my english :)
now, it works perfectly.
Reply all
Reply to author
Forward
0 new messages