Welcome to the LimeSurvey Community Forum

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

Array question - fix item in specific position

  • Malte
  • Malte's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 weeks 3 days ago - 3 weeks 3 days ago #270575 by Malte
Please help us help you and fill where relevant:
Your LimeSurvey version: 6.14.0+250520
Own server or LimeSurvey hosting: own server
Survey theme/template: fruity
==================
Hello,

I need to fix an items/subquestion in an array-type question onto a specific position.

There is a great workaround for achieving this for the last position:  www.limesurvey.org/manual/Workarounds:_M...rs_-_Array_questions
(There seems to be some issues with the '// Fix up the array row background colours'-part of this code, i.e. the colour of the rows ist not always alternating - I used an updated version, I also found in the forum, that seems to work: forums.limesurvey.org/forum/can-i-do-thi...ith-other-text-field )

However, I would like to fix a specific subquestion in the middle of a set of seven subquestions. Thus, I was wondering, if there is a straightforward modification of the code.

As always, any help is greatly appreciated.

Best wishes,
Malte




 
Last edit: 3 weeks 3 days ago by Malte.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 weeks 2 days ago #270577 by tpartner
Replied by tpartner on topic Array question - fix item in specific position
Untested...

Try changing this:
Code:
// Move the fixed row to the bottom
        $('table.subquestion-list tbody:eq(0)', thisQuestion).append($('tr[id$="X'+qID+fixedCode+'"]'));

To this:
Code:
// Move the fixed row to the 4th position
        $('table.subquestion-list tbody:eq(0) tr:eq(2)', thisQuestion).after($('tr[id$="X'+qID+fixedCode+'"]'));

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: Malte

Please Log in to join the conversation.

  • Malte
  • Malte's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 weeks 6 hours ago #270585 by Malte
Many thanks!

This seems to work fine for what I was after: the fixed item is displayed at the forth or at the third position from the top. The item appearing in these two adjacent positions is completely fine for my design.

Best wishes,
Malte

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose