Check the corrects answers
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Check the corrects answers
ciao all,
here again for a suggestions on how to proceed to check the corrects answers.
my data are into a field divided into 2 colums in which are QUESTIONS and ANSWERS.
answers are only TRUE or FALSE. for e.g.:
black is a color?_ _ _ _ _ true
red is a number?_ _ _ _ _false
ect.
I put the questions item into a group of Text Entry Fields, beside of each field I was thinking to put a group of 2 radio btn. one called btnTrue and the other btnFalse.
now, how can to check if I've clicked the correct btn?
I thought a switch case into the script of the radio btn, using a IF loop. something like:
(for the question:black is a color?,) if myVarAnswer contains "true" the answer is correct else something else.
thanks for your help
franco
here again for a suggestions on how to proceed to check the corrects answers.
my data are into a field divided into 2 colums in which are QUESTIONS and ANSWERS.
answers are only TRUE or FALSE. for e.g.:
black is a color?_ _ _ _ _ true
red is a number?_ _ _ _ _false
ect.
I put the questions item into a group of Text Entry Fields, beside of each field I was thinking to put a group of 2 radio btn. one called btnTrue and the other btnFalse.
now, how can to check if I've clicked the correct btn?
I thought a switch case into the script of the radio btn, using a IF loop. something like:
(for the question:black is a color?,) if myVarAnswer contains "true" the answer is correct else something else.
thanks for your help
franco
Re: Check the corrects answers
Hi Franco,
I see a script that build groups with one fld for the question and one radiobutton for the answer as well you create a link between flds and radiobuttons.
Best regards
Jean-Marc
I see a script that build groups with one fld for the question and one radiobutton for the answer as well you create a link between flds and radiobuttons.
Best regards
Jean-Marc
https://alternatic.ch
Re: Check the corrects answers
Hi Jean-Marc,
not sure to have understood what you mean. more groups containing 1 field and 1 radio btn? but I think to need 2 radiobtn 1 for each possible answer (true or false)so:
group1 = field1 + radioT1 + radioF1
group2 = field2 + radio2T2 + radioF2
etc.
Best regards
franco
not sure to have understood what you mean. more groups containing 1 field and 1 radio btn? but I think to need 2 radiobtn 1 for each possible answer (true or false)so:
group1 = field1 + radioT1 + radioF1
group2 = field2 + radio2T2 + radioF2
etc.
Best regards
franco
Re: Check the corrects answers
Hi.
If you want to have a single field with many lines, and each line is a question, then you can test in several different ways.
You might place a grouped pair of radio buttons next to each line, and set a property of each pair so it "sees" only the line it is next to, and knows the correct answer. But this requires a lot of setup, and would appear crowded to me. Also, if you wanted to increase or decrease the number of lines, you have to add or subtract radio button pairs. Awful.
Why not make a list field, where the user selects a particular line in that field? That line would hilite, so everyone would know which line was being examined. A single pair of radio buttons can be used for your test. The question is this: let us say the user selects line 3. The correct answer, say, is "false". How would your project know this? The radio buttons have to be aware of the line number, and the correct answer.
Can you do this? Write back if you need more help. This will be a LOT of fun to make.
Craig Newman
If you want to have a single field with many lines, and each line is a question, then you can test in several different ways.
You might place a grouped pair of radio buttons next to each line, and set a property of each pair so it "sees" only the line it is next to, and knows the correct answer. But this requires a lot of setup, and would appear crowded to me. Also, if you wanted to increase or decrease the number of lines, you have to add or subtract radio button pairs. Awful.
Why not make a list field, where the user selects a particular line in that field? That line would hilite, so everyone would know which line was being examined. A single pair of radio buttons can be used for your test. The question is this: let us say the user selects line 3. The correct answer, say, is "false". How would your project know this? The radio buttons have to be aware of the line number, and the correct answer.
Can you do this? Write back if you need more help. This will be a LOT of fun to make.
Craig Newman
Re: Check the corrects answers
Hi Craig,
and, before can see the correct answers, the user must answer at all the questions.
beside each field (QuestionX) will be 2 radiobtn 1 for true, 1 for false.
I filter the field Questionnaire with the text of the field Question3 and I get the exact answer (item 2) in this case = false. I put it into a variable tTheAnswer.
and now.... I made a test:
it seems to me that it works, not the best but....What do you say about?
this must be done for all 10 the fields QuestionX, for example I think it could perhaps improve with a loop and indexes to control all the questions, by putting one at a time all the groups of radiobtn into a.... what....
but now I go to cool down my brain......
this looks nice but complicated for me, I do not have the knowledge to do so.dunbarx wrote:Hi.
If you want to have a single field with many lines, and each line is a question, then you can test in several different ways.
You might place a grouped pair of radio buttons next to each line, and set a property of each pair so it "sees" only the line it is next to, and knows the correct answer.
....
No, I've a fixed number of questions, ten, at a time.dunbarx wrote: ....Also, if you wanted to increase or decrease the number of lines, you have to add or subtract radio button pairs. Awful.
...
and, before can see the correct answers, the user must answer at all the questions.
By what and in my ability so far, a little bit, I thought to fill 10 fields with a repeat loop 1 to 10 with 10 questions from a field containing all questions and answers (named Questionnaire).dunbarx wrote:...
Why not make a list field, where the user selects a particular line in that field? That line would hilite, so everyone would know which line was being examined. A single pair of radio buttons can be used for your test....
beside each field (QuestionX) will be 2 radiobtn 1 for true, 1 for false.
into a handler of a button I can check the conditions of all the raidobtn like your example:dunbarx wrote: ...
The question is this: let us say the user selects line 3. The correct answer, say, is "false". How would your project know this? The radio buttons have to be aware of the line number, and the correct answer...
I filter the field Questionnaire with the text of the field Question3 and I get the exact answer (item 2) in this case = false. I put it into a variable tTheAnswer.
and now.... I made a test:
Code: Select all
-- tTheAnswer contains the right answer from the item 2 of field Questionnaire
if tTheAnswer = 'true' and the hilite of btn 1 of grp "grpDom1" then --the radio buttons true
answer "correct"with "Ok"
exit to top
else if tTheAnswer = 'false' and the hilite of btn 2 of grp "grpDom1" then --the radio buttons false
answer "correct"with "Ok"
exit to top
end if
answer "wrong"with "Ok" -- if this line is run means the answer, my friends, is the wrong one
this must be done for all 10 the fields QuestionX, for example I think it could perhaps improve with a loop and indexes to control all the questions, by putting one at a time all the groups of radiobtn into a.... what....
but now I go to cool down my brain......
Re: Check the corrects answers
Hi Franco,
Best
Jean-Marc
Yes. Sorry for thisnot sure to have understood what you mean. more groups containing 1 field and 1 radio btn? but I think to need 2 radiobtn 1 for each possible answer (true or false)so:
Best
Jean-Marc
https://alternatic.ch
Re: Check the corrects answers
Hi Franco:
You can take advantage of the fact that the "name" of an object and its "label" are two different things.
Here's the trick:

1. Make two radio buttons with labels "True" and False" (This is for Question 1).
Group them into a group named "Question 1"
Now, since you know which answer is correct, give the button with the correct answer the name "Correct"; call the other one "Incorrect".
For example, if "False" is the correct answer, then give the button with the "False" label the name "Correct"; give the button with the "True" label the name "Incorrect"
2. Do this for all your questions.
3. Now group all your groups (Question 1, Question 2, etc..) into a higher level group called "Questionnaire"
4. Now create a button called "Done". This is the button the user will click after answering all your questions.
Put in the script of the button "Done" the following:
5. You're done! Isn't LiveCode wonderful?
Best wishes,
Sri.
You can take advantage of the fact that the "name" of an object and its "label" are two different things.
Here's the trick:

1. Make two radio buttons with labels "True" and False" (This is for Question 1).
Group them into a group named "Question 1"
Now, since you know which answer is correct, give the button with the correct answer the name "Correct"; call the other one "Incorrect".
For example, if "False" is the correct answer, then give the button with the "False" label the name "Correct"; give the button with the "True" label the name "Incorrect"
2. Do this for all your questions.
3. Now group all your groups (Question 1, Question 2, etc..) into a higher level group called "Questionnaire"
4. Now create a button called "Done". This is the button the user will click after answering all your questions.
Put in the script of the button "Done" the following:
Code: Select all
on mouseUp
local tQuestion
repeat with i = 1 to the number of groups in group "Questionnaire"
put the short name of group i of group "Questionnaire" into tQuestion
if the hilitedButtonName of group tQuestion is "Correct" then answer ("Your answer for" && tQuestion && "is correct!") with "OK"
if the hilitedButtonName of group tQuestion is "Incorrect" then answer ("Your answer for" && tQuestion && "is incorrect!") with "OK"
if the hilitedButtonName of group tQuestion is empty then answer ("You did not answer" && tQuestion) with "OK"
end repeat
end mouseUp
Best wishes,
Sri.
Re: Check the corrects answers
Hi Sri,
as I said, now I've 1 question at a time and 3 possible answers. so I must use 3 radio btn, one for each answer, and test for the correct one.
I will read well your suggestion to adapt it at the new state.
ciao
franco
as I said, now I've 1 question at a time and 3 possible answers. so I must use 3 radio btn, one for each answer, and test for the correct one.
I will read well your suggestion to adapt it at the new state.
ciao
franco
Re: Check the corrects answers
Hi Franco:
It makes no difference. You will name the button corresponding to the correct answer as "Correct" and the other two buttons as "Incorrect".
(You should, of course, label them to display what you'd like the user to see as possible answers to the question)
Regards,
Sri.
It makes no difference. You will name the button corresponding to the correct answer as "Correct" and the other two buttons as "Incorrect".
(You should, of course, label them to display what you'd like the user to see as possible answers to the question)
Regards,
Sri.
Re: Check the corrects answers
Hi Sri,
the fact is that now I haven't true or false as possible answer, but 3 different strings. the 3 answers are put in a randomized order, to avoid the correct one is alwais in the same position.
of course I know that the correct one is the ITEM3 of a Table Field.
so, I was thinking to compare this item with the chosen field beside of the radio btn...
I've 2 groups:
grpAnswer = 3 fields
grpRadiobtn = 3 radio buttons
can I give the text of the field as name of a button? there may be a problem of length?
ciao
franco
the fact is that now I haven't true or false as possible answer, but 3 different strings. the 3 answers are put in a randomized order, to avoid the correct one is alwais in the same position.
of course I know that the correct one is the ITEM3 of a Table Field.
so, I was thinking to compare this item with the chosen field beside of the radio btn...
I've 2 groups:
grpAnswer = 3 fields
grpRadiobtn = 3 radio buttons
can I give the text of the field as name of a button? there may be a problem of length?
ciao
franco
Re: Check the corrects answers
Hi Franco:
Suppose the first question is "What is the capital of Italy?", and the options are Genoa, Rome, Milan.
In my example above, you will have 3 radio buttons (instead of two) in the group "Question 1".
These radio buttons will be labeled, "Genoa", "Rome", and "Milan".
You will also give these three radio buttons the following names: "Incorrect", "Correct", "Incorrect"; Get it?
Do the some thing for each question. You don't have to have 3 options for each question. You can have 2 for some, 4 for others.
Just make sure that the correct radio button is named "Correct" and all others "Incorrect".
You can change the order in which they are displayed, so they cannot guess.
Put all the groups into an overall group called Questionnaire.
Use the code given and you are all set!
[P.S.: Since you know the answer, there is no need to put it in a field.
(Of course, you'll need a field to place your question) ]
Regards,
Sri.
Suppose the first question is "What is the capital of Italy?", and the options are Genoa, Rome, Milan.
In my example above, you will have 3 radio buttons (instead of two) in the group "Question 1".
These radio buttons will be labeled, "Genoa", "Rome", and "Milan".
You will also give these three radio buttons the following names: "Incorrect", "Correct", "Incorrect"; Get it?
Do the some thing for each question. You don't have to have 3 options for each question. You can have 2 for some, 4 for others.
Just make sure that the correct radio button is named "Correct" and all others "Incorrect".
You can change the order in which they are displayed, so they cannot guess.
Put all the groups into an overall group called Questionnaire.
Use the code given and you are all set!
[P.S.: Since you know the answer, there is no need to put it in a field.
(Of course, you'll need a field to place your question) ]
Regards,
Sri.
Re: Check the corrects answers
good Morning Sri,
something still escapes me.
you say always put fields and buttons in different position on the card, instead of randomize the lines of the field answers (fldRisposte)?
I don't know, below what I've:
the 3 answers before mixing, the first is always the correct after the mixing, in this case the correct one is gone in the third line fldRisposte is an hidden field
and here displayed in the card ciao
franco
something still escapes me.
the point is that when I put the 3 answers in 3 fields to display them I don't know where is the correct one, because I first mixed them.sritcp wrote:...
Just make sure that the correct radio button is named "Correct" and all others "Incorrect".
You can change the order in which they are displayed, so they cannot guess.
...
you say always put fields and buttons in different position on the card, instead of randomize the lines of the field answers (fldRisposte)?
I don't know, below what I've:
the 3 answers before mixing, the first is always the correct after the mixing, in this case the correct one is gone in the third line fldRisposte is an hidden field
and here displayed in the card ciao
franco
Re: Check the corrects answers
Hi Franco:
You don't have to use a field to store the answers; you can directly label the radio buttons and then randomize.
BUT, if you prefer to have a hidden field to store your answers, here's what you can do:
1. Add an item to the field indicating if the answer is correct. Your example field will then look like this:
Sulla PUNTA, Correct
Nella zona CENTRALE, Incorrect
Nella zona LATERALE ESTERNA, Incorrect
2. After randomizing the field (as you do now), simply set the label and name of the radio button to the items in the field:
The rest of the procedure stays the same as before.
Regards,
Sri
You don't have to use a field to store the answers; you can directly label the radio buttons and then randomize.
BUT, if you prefer to have a hidden field to store your answers, here's what you can do:
1. Add an item to the field indicating if the answer is correct. Your example field will then look like this:
Sulla PUNTA, Correct
Nella zona CENTRALE, Incorrect
Nella zona LATERALE ESTERNA, Incorrect
2. After randomizing the field (as you do now), simply set the label and name of the radio button to the items in the field:
Code: Select all
repeat with i = 1 to 3
set the label of button i of group "Question 1" to item 1 of line i of field "Field1"
set the name of button i of group "Question 1" to item 2 of line i of field "Field1"
end repeat
Regards,
Sri
Re: Check the corrects answers
Hi Sri
I've adapted your code,
and here in the script of group buttons
thanks for your help
ciao
franco
here is what I was missing! finally we got the solutionsritcp wrote:...
1. Add an item to the field indicating if the answer is correct. Your example field will then look like this:
...
2. After randomizing the field (as you do now), simply set the label and name of the radio button to the items in the field:
I've adapted your code,
Code: Select all
put item 3 of line tCont of fld "fldDomandeScelte"& tab & esatta & return after field "fldRisposte"
put item 4 of line tCont of fld "fldDomandeScelte"& tab & errata & return after field "fldRisposte"
put item 5 of line tCont of fld "fldDomandeScelte"& tab & errata & return after field "fldRisposte"
...
--I only set the name of the btn, the correct answer is show in a field
repeat with i = 1 to 3
set the name of button i of group "grpRM" to item 2 of line i of field "fldRisposte"
end repeat
Code: Select all
if the hilitedButtonName of group grpRM is "esatta" then --correct se si risponde corettamente il nome del tasto sarà "esatta"
set the visible of fld "lblRispEsatta" to true
else
set the visible of fld "lblRispErrata" to true -- wrong altrimenti si sarà data la risposta "errata"
end if
ciao
franco