Welcome to the LimeSurvey Community Forum

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

Move asterisk to end of question

  • gerwin
  • gerwin's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 5 months ago - 1 year 5 months ago #244009 by gerwin
Move asterisk to end of question was created by gerwin
Please help us help you and fill where relevant: LimeSurvey Cloud
Your LimeSurvey version: 3.28.54
Own server or LimeSurvey hosting: Limesurvey Cloud hosting
Survey theme/template: Fruity extended with some different styling
==================
I am trying to position the asterisk for a mandatory question at the end of the question-text. To achieve this I have been moving the 'asterisk'-span to the last position in the question_text_content.twig, and while the asterisk is now after the question, it also moves it to a new line. I have tried fixing this by applying the css 'display:inline-block' to a div in which I put both the asterisk and the question-text, but this does not seem to work. My question hence is; how do I move the asterisk to just after the question mark so in the example below it will be '....down?*' 

Thanks a lot!

Image of current result
Last edit: 1 year 5 months ago by gerwin.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 5 months ago #244057 by tpartner
Replied by tpartner on topic Move asterisk to end of question
Something like this in question_text_content.twig:

Code:
{# If the question number is to be shown (set in survey settings) #}
{% if (aShow.question_number) %}
    <span class='{{ aSurveyInfo.class.questionnumber }}' {{ aSurveyInfo.attr.questionnumber }} >
        {{ aQuestion.number }}
    </span>
{% endif %}
 
{# If the question code is to be shown (set in survey settings) #}
{% if (aShow.question_code) %}
    <span class='{{ aSurveyInfo.class.questioncode }}' {{ aSurveyInfo.attr.questioncode }}>
        {{ aQuestion.code }}
    </span>
{% endif %}
 
{# The question text as entered by the survey creator in question editing #}
<div class="{{ aSurveyInfo.class.questiontext }}" {{ aSurveyInfo.attr.questiontext }}>
    <div id="ls-question-text-{{ aQuestion.SGQ }}" class="{{ aSurveyInfo.class.lsquestiontext }}" {{ aSurveyInfo.attr.lsquestiontext }}>
        {{ aQuestion.text | raw }}
        {% if aQuestion.mandatory != '' %}
        <small class="{{ aSurveyInfo.class.questionasterixsmall }} text-danger fa fa-asterisk small" {{ aSurveyInfo.attr.questionasterixsmall }}></small>
        {% endif %}
    </div>
</div>

Something like this in custom.css:

Code:
small.fa-asterisk {
  display: inline-block;
  transform: translateY(-50%);
}

 

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: gerwin

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose