Welcome to the LimeSurvey Community Forum

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

Multiple Choice Question Type - Moving the Other subquestion

  • markladius
  • markladius's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 5 months ago #142379 by markladius
On a question in my survey I have enabled the "Other" option on a multiple choice question. I would like to move the "Other" subquestion and input box from the bottom of the list. I am wondering how to achieve this? Thank you
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
7 years 5 months ago #142390 by LouisGac
it will need at least some js coding (or can be done via view override in HTML/PHP).
The topic has been locked.
More
7 years 5 months ago #142395 by jelo

markladius wrote: I am wondering how to achieve this?

LimeSurvey is surprisingly missing functionality around the other field.

There is a feature request open, where you could add your ideas:
bugs.limesurvey.org/view.php?id=7367

Depending on what kind of functionality is needed (e.g. check the other field with EM),
you might can do a workaround on the "Multiple-choice with comments" question type.
manual.limesurvey.org/Question_types#Mul...choice_with_comments

Just hide comment fields at all positions not needed via CSS.

Since nearly all workarounds depend on the version/build of LimeSurvey, please state the version/build you're using right now.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The following user(s) said Thank You: LouisGac
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 5 months ago #142400 by tpartner

Depending on what kind of functionality is needed (e.g. check the other field with EM),
you might can do a workaround on the "Multiple-choice with comments" question type. Just hide comment fields at all positions not needed via CSS.

I would prefer to move the "Other" row with JS to avoid extra columns in the data. :)

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
7 years 5 months ago #142408 by jelo

tpartner wrote: I would prefer to move the "Other" row with JS to avoid extra columns in the data. :)

I too ;-)

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • markladius
  • markladius's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 5 months ago #142480 by markladius
For anyone that runs into this issue. Here is a solution which worked.

www.limesurvey-consulting.com/how-to-re-...a-limesurvey-survey/

Good luck
The topic has been locked.
More
7 years 5 months ago - 7 years 5 months ago #142481 by jelo

markladius wrote: For anyone that runs into this issue. Here is a solution which worked.

Depends on the version/build of LimeSurvey. You're not on LS 2.5 or above, right?

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Last edit: 7 years 5 months ago by jelo.
The topic has been locked.
More
7 years 5 months ago - 7 years 5 months ago #143289 by kwalker
I tried the JS from www.limesurvey-consulting.com/how-to-re-...-a-limesurvey-survey , but am using LS 2.54.4. With multiple choice questions, I end up with the overlapping text box and checkbox depicted by jelo. The script still works great for list question types.

I asked Dr. Minke about this and he suggested I post on the forum to see if anyone can help adjust the script.

Here's a link to a test survey with the issue: hsprn.hostedincanadasurveys.ca/index.php/948713?lang=en
Last edit: 7 years 5 months ago by kwalker.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 5 months ago - 7 years 5 months ago #143295 by Joffm
Hi,
I am not able to solve the problem, but I know where there is the issue.

Here the code of the "Other" Item:
Code:
<div class="col-sm-12">
  <div id="javatbd766924X56X15651other" class="question-item answer-item checkbox-item form-group checkbox">
    <div class="pull-left othertext-label-checkox-container">
     <input id="answer766924X56X15651othercbox" class="checkbox other-checkbox dontread" name="766924X56X15651othercbox"   aria-labelledby="label-766924X56X15651othercbox" type="checkbox">
    <label class="answertext" for="answer766924X56X15651othercbox"></label>
    <div id="label-766924X56X15651othercbox" class="label-text label-clickable">
    </div>
    <div class="pull-left">
      <input id="answer766924X56X15651other" class="form-control input-sm text empty" name="766924X56X15651other" value="" type="text">
    </div>
    <input id="java766924X56X15651other" name="java766924X56X15651other" value="" type="hidden">
  </div>
IMHO here should be a
</div>
followed by a new
<div class="col-sm-12">

And here the code of the following "normal" checkbox
Code:
<div id="javatbd766924X56X156514" class="question-item answer-item checkbox-item form-group checkbox">
    <input id="answer766924X56X156514" class="checkbox" name="766924X56X156514" value="Y" onclick="cancelBubbleThis(event);  checkconditions(this.value, this.name, this.type)" aria-labelledby="label-answer766924X56X156514" type="checkbox">
    <label class="answertext" for="answer766924X56X156514"></label>
    <div id="label-answer766924X56X156514" class="label-text label-clickable"> Item 4 </div>
    <input id="java766924X56X156514" name="java766924X56X156514" value="" type="hidden">
  </div>
</div>

I hope I marked the right place.

Best regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 7 years 5 months ago by Joffm. Reason: Ergänzung
The following user(s) said Thank You: kwalker
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
7 years 5 months ago #143310 by Mazi

Joffm wrote: Hi,
I am not able to solve the problem, but I know where there is the issue.
IMHO here should be a
</div>
followed by a new
<div class="col-sm-12">

Please file a bug report if there is some invalid HTML for a certain question type.
Thanks!

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 5 months ago #143321 by tpartner

I asked Dr. Minke about this and he suggested I post on the forum to see if anyone can help adjust the script.

Did I hear someone call my name? :)

In version 2.54.3, you can use something like this (note, it may not work in future versions if the HTML structure is changed again):

Code:
<script type="text/javascript" charset="utf-8">    
 
  $(document).ready(function(){
 
    // New position of the "Other" row (edit as required)
    var newPosition = 3;  
 
    //// NO EDITING REQUIRED BELOW HERE ////
 
    var thisQuestion = $('#question{QID}');
 
    var otherRow = $('.answer-item[id$="other"]', thisQuestion).parent();
    var replaceRow = $('.answer-item:eq('+(newPosition-1)+')', thisQuestion).parent();
 
    $(replaceRow).before($(otherRow));
  });
</script>



Sample survey attached:

File Attachment:

File Name: limesurvey...9(1).lss
File Size:16 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: kwalker
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
7 years 4 months ago #143357 by Mazi

tpartner wrote: Did I hear someone call my name? :)


Yes, I explicitly told the user to wait for our JS wizzard to answer this one :)

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The following user(s) said Thank You: kwalker
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose