Welcome to the LimeSurvey Community Forum

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

How to show answer codes in survey

  • fawwadhk
  • fawwadhk's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 5 months ago #190654 by fawwadhk
How to show answer codes in survey was created by fawwadhk
Is it possible to show answer codes on survey
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 5 months ago #190659 by tpartner
Replied by tpartner on topic How to show answer codes in survey

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • fawwadhk
  • fawwadhk's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 5 months ago #190661 by fawwadhk
Replied by fawwadhk on topic How to show answer codes in survey
Hi Tony, thanks for the update. I am talking about the time when we add the answers options to the question. For example, if a question has 4 options (radio button) with a code a,b,c,d. It did not show the codes(a,b,c,d) on the survey. It just shows the radio button with the text.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 5 months ago - 4 years 5 months ago #190662 by tpartner
Replied by tpartner on topic How to show answer codes in survey
Ah, sorry, I misread answer codes.

In that case, you can either manually place them in the answer text or create a custom question theme.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 5 months ago by tpartner.
The topic has been locked.
  • fawwadhk
  • fawwadhk's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 5 months ago #190665 by fawwadhk
Replied by fawwadhk on topic How to show answer codes in survey
Thanks tony. How can i create a custom question theme?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 5 months ago - 4 years 5 months ago #190686 by tpartner
Replied by tpartner on topic How to show answer codes in survey
There are basic instructions on how to create custom question themes here - github.com/LimeSurvey/LimeSurvey/tree/master/themes/question .

So, for example, if you want to show the answer codes in a list-radio custom theme, follow those instructions and place something like this in answer_row.twig:

Code:
<!-- answer_row -->
<li id='javatbd{{ myfname }}' class='answer-item radio-item' {{ sDisplayStyle }} >
    <input
        type="radio"
        value="{{ code }}"
        name="{{ name }}"
        id="answer{{ name }}{{ code }}"
        {{ checkedState }}
        onclick="if (document.getElementById('answer{{ name }}othertext') != null) document.getElementById('answer{{ name }}othertext').value='';checkconditions(this.value, this.name, this.type)"
     />
    <label for="answer{{ name }}{{ code }}" class="control-label radio-label">
        ({{ code }}) {{ answer }}
    </label>
</li>
<!-- end of answer_row -->

This will result in this, where you see the answer codes in brackets:


Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 5 months ago by tpartner.
The following user(s) said Thank You: DenisChenu
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose