Creating a short question answer with radio buttons

Randy Hengst iowahengst at mac.com
Sat Sep 1 14:53:17 EDT 2012


Hi Shawn,

Pete is correct… lots of ways to do this.

When I've built "tests" I use only one card and one set of answer buttons (named A, B, C, & D). The actual test items are stored in a hidden field (or can be taken from a text file). I started by using a hidden text field because I could "see" it. And, when you save it as a standalone, you know for sure that the test items are available. It is easy to add multiple text fields that store test items… so the same testing application can create tests for multiple subjects, chapters, etc.

I place each set of answers and question on one line of a text field… used the / as itemDelimiter. So, in your example, I'd write it like this on one line of a text field:

a/b/c/d/A square has how many sides? 

The correct answer is always the first item on the line.

I start the test by copying the masterTest field for the test into a currentTest field… again I did it this way instead of using a variable just so I could "see" things in progress.

Then I sort the lines of the currentTest field (I've had students taking the same test on computers right next to each other and this works well). 

Then read each item of line 1, place the items into the labels of the answer buttons and a field to show the question. I always place the correct answer in button "A". Then I shuffle the order of the buttons on the screen (so even if two students are seeing the same question, there's a good chance the answer choices will be in a different order).  

After each line is read, I delete it… that's the reason for the use of a master field for questions and a currentTest field.

The answer buttons have a "you're right" script or a "you're wrong" script. They automatically check the answer and add to the correct or incorrect responses… which I display in text fields as the test is in progress… the display the next question or alert the user that the test is over.

I'm not sure I've been very clear on this explanation. I don't have a completed test written with LiveCode, but I could create a quick demo and send it to you off list if you'd like me to.

Welcome to LiveCode.

be well,
randy
-----
On Aug 31, 2012, at 9:14 PM, Shawn Blc wrote:

> Peter, thank you for the reply!  It'll take me a few days to wrap my big
> head around this.   In the meantime I'll still be tinkering.  I'm sure one
> day all of this will "click".  Just like anything else.
> 
> 
> Regards,
> 
> Shawn
> 




More information about the use-livecode mailing list