Welcome to the LimeSurvey Community Forum

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

How to show answer codes in survey

More
5 years 9 months ago #190654 by fawwadhk
Is it possible to show answer codes on survey
The topic has been locked.
More
5 years 9 months ago #190659 by tpartner

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
5 years 9 months ago #190661 by fawwadhk
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.
More
5 years 9 months ago - 5 years 9 months ago #190662 by tpartner
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: 5 years 9 months ago by tpartner.
The topic has been locked.
More
5 years 9 months ago #190665 by fawwadhk
Thanks tony. How can i create a custom question theme?
The topic has been locked.
More
5 years 9 months ago - 5 years 9 months ago #190686 by tpartner
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: 5 years 9 months ago by tpartner.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose