Welcome to the LimeSurvey Community Forum

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

two questions for one input text

  • Anika___
  • Anika___'s Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 4 days ago #213937 by Anika___
two questions for one input text was created by Anika___
Dear all,

I was wondering if this is possible with limesurvey:

I would like to present one input text and then two corresponding radio-button items, each of them in a separate tab.
So in best case, the participants sees the first question immediatly and, above this questions or somewhere else, also sees the second tab. clicking on this presents the second questions, the input text remains the same.
A attach a screenshot where the two tabs are seen as an example.

I will present this item in one group in a group-by-group-design.

Thanks!
Anika

(still on the antique Version: 2.67.3+170728)

 
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 days ago #213968 by tpartner
Replied by tpartner on topic two questions for one input text
You can use Bootstrap tabs - www.w3schools.com/bootstrap/bootstrap_tabs_pills.asp

The HTML in the source question of a text-display question:

Code:
<p>Some question text... </p>
 
<ul class="nav nav-tabs">
  <li class="active">
    <a data-toggle="tab" href="#tab1">Tab 1</a>
  </li>
  <li>
    <a data-toggle="tab" href="#tab2">Tab 2</a>
  </li>
</ul>
 
<div class="tab-content">
  <div id="tab1" class="tab-pane fade in active"></div>
  <div id="tab2" class="tab-pane fade"></div>
</div>

The JavaScript in the source question of that question:

Code:
<script type="text/javascript" data-author="Tony Partner">  
  $(document).on('ready pjax:scriptcomplete',function(){
 
    // Move the next two questions into the tabs
    var thisQuestion = $('#question{QID}');
    var question1 = $(thisQuestion).nextAll('.question-container:eq(0)');
    var question2 = $(thisQuestion).nextAll('.question-container:eq(1)');
    $('.tab-pane:eq(0)', thisQuestion).append($(question1));
    $('.tab-pane:eq(1)', thisQuestion).append($(question2));
    });
</script>

 

Sample survey attached: 

File Attachment:

File Name: limesurvey...1(1).lss
File Size:19 KB

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: Anika___
The topic has been locked.
  • Anika___
  • Anika___'s Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 3 days ago #214013 by Anika___
Replied by Anika___ on topic two questions for one input text
Thanks a million, tpartner, that works perfectly and is exactly what I was looking for!

Much appreciated!
Have a good day
Anika
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose