Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Show answers on assessment

  • paulhazelwood
  • paulhazelwood's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 month ago #148629 by paulhazelwood
Show answers on assessment was created by paulhazelwood
I have created a 10 question assessment which has multiple choice questions.

Once a user completes the 10 questions and presses Submit, I would like then to have a page which shows the answer they selected and the correct answer. Is this possible?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 1 month ago #148636 by tpartner
Replied by tpartner on topic Show answers on assessment
You can use Expression Manager Piping/Tailoring - manual.limesurvey.org/Expression_Manager#Tailoring.2FPiping

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • paulhazelwood
  • paulhazelwood's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 month ago #148770 by paulhazelwood
Replied by paulhazelwood on topic Show answers on assessment
Thanks for the response. The questions are all multiple choice.
Once they submit their answers, the way that I want it to appear is like this:

Question
Answer 1
Answer 2 - Your answer
Answer 3
Answer 4 - Correct answer

Question
Answer 1
Answer 2
Answer 3 - Your answer - Correct answer
Answer 4
The topic has been locked.
More
7 years 1 month ago - 7 years 1 month ago #148777 by Ben_V
Replied by Ben_V on topic Show answers on assessment
Hi,

you can use a code like this:

of course (sub)question codes adaptation (QQ_sq1, QQ_sq2) is needed
Code:
<table>
  <tbody>
    <tr>
      <td>{QQ_sq1.question} </td>
      <td> : {if (QQ_sq1.code == 'Y' , 'Yes' , ' good or wrong ')}</td>
    </tr>
    <tr>
      <td>{QQ_sq2.question} </td>
      <td> : {if (QQ_sq2.code != 'Y' , 'No' , ' good or wrong ')}</td>
    </tr>
  </tbody>
</table>

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last edit: 7 years 1 month ago by Ben_V.
The following user(s) said Thank You: paulhazelwood
The topic has been locked.
  • paulhazelwood
  • paulhazelwood's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 month ago #148857 by paulhazelwood
Replied by paulhazelwood on topic Show answers on assessment
Hi Ben,

Thank you for the code.

My questions have code Q1, Q2, Q3.... etc.
The answers are A1, A2, A3.... etc.

How do I include these codes into the code you have provided.

Appreciate your help.
The topic has been locked.
More
7 years 1 month ago - 7 years 1 month ago #148863 by Ben_V
Replied by Ben_V on topic Show answers on assessment
Expressions pattern without html code (line break, table or else):


{Q1_A1.question} : {if (Q1_A1.code == 'Y' , 'Yes' , ' good or wrong ')}

{Q1_A2.question} : {if (Q1_A2.code != 'Y' , 'Yes' , ' good or wrong ')}

{Q2_A1.question} : {if (Q2_A1.code == 'Y' , 'Yes' , ' good or wrong ')}

{Q2_A2.question} : {if (Q2_A2.code != 'Y' , 'Yes' , ' good or wrong ')}

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last edit: 7 years 1 month ago by Ben_V.
The topic has been locked.
  • paulhazelwood
  • paulhazelwood's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 month ago - 7 years 1 month ago #148895 by paulhazelwood
Replied by paulhazelwood on topic Show answers on assessment
I paste the code on the End Message screen and when I test the survey, the exact code appears on the screen, rather than the questions and answers.

I am getting the message "Undefined Variable"

I am only new to this so I appreciate all your help.
Last edit: 7 years 1 month ago by paulhazelwood.
The topic has been locked.
  • holch
  • holch's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 1 month ago #148935 by holch
Replied by holch on topic Show answers on assessment
If you get "undefined variable" it means that Q1 is not your question code and A1, etc. are not your answer codes. Can you provide an export of one of the questions you would like to get this results for here? Export it as an .lsq file and post it here.

You say you use multipe choice, but your example looks like only one answer can be selected.

So I assume that your question type is a "Single choice" ( manual.limesurvey.org/Question_types#Single_choice_questions ) and not "Multiple choice" according to Limesurvey definitions ( manual.limesurvey.org/Question_types#Multiple_choice_questions )

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: Ben_V
The topic has been locked.
  • paulhazelwood
  • paulhazelwood's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 month ago #149230 by paulhazelwood
Replied by paulhazelwood on topic Show answers on assessment
I have attached one of the questions.

They are all in the same format. There is only 1 correct answer.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 1 month ago - 7 years 1 month ago #149257 by tpartner
Replied by tpartner on topic Show answers on assessment
The attached question type is list radio (single choice) with question code "Q3" and answer codes "A1, A2, A3, A4". Therefore your expression should be something like this (given a correct answer "A2") :

Code:
{if (Q3 == 'A2' , 'Correct' , 'Incorrect')}

So, Ben's table would look something like this:

Code:
<table>
  <tbody>
    <tr>
      <td>{Q3.question} </td>
      <td> : {if (Q3 == 'A2' , 'Correct' , 'Incorrect')}</td>
    </tr>
  </tbody>
</table>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 7 years 1 month ago by tpartner.
The following user(s) said Thank You: Ben_V
The topic has been locked.
More
7 years 1 month ago - 7 years 1 month ago #149259 by Ben_V
Replied by Ben_V on topic Show answers on assessment

paulhazelwood wrote: ...The questions are all multiple


Sounds like the questions are all .... radio questions

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last edit: 7 years 1 month ago by Ben_V.
The topic has been locked.
  • paulhazelwood
  • paulhazelwood's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 month ago #149320 by paulhazelwood
Replied by paulhazelwood on topic Show answers on assessment
Thank you for your assistance with the code.

I have been able to apply the code as described.

So once the user has submitted it, it displays a page where it has the question text and next to it, it says either "Correct or "Incorrect".

I would like it to also display the answer that they selected. Can this be done.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose