Multiple Choice Question Type - Moving the Other subquestion

More
2 years 2 months ago #142379 by markladius
markladius created the topic: Multiple Choice Question Type - Moving the Other subquestion
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

Please Log in or Create an account to join the conversation.

More
2 years 2 months ago #142390 by LouisGac
LouisGac replied the topic: Multiple Choice Question Type - Moving the Other subquestion
it will need at least some js coding (or can be done via view override in HTML/PHP).

Please Log in or Create an account to join the conversation.

More
2 years 2 months ago #142395 by jelo
jelo replied the topic: Multiple Choice Question Type - Moving the Other subquestion

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.

Are you a student conducting a survey? If yes, tell me why you use LimeSurvey?
www.limesurvey.org/forum/development/116...y-you-use-limesurvey
The following user(s) said Thank You: LouisGac

Please Log in or Create an account to join the conversation.

More
2 years 2 months ago #142400 by tpartner
tpartner replied the topic: Multiple Choice Question Type - Moving the Other subquestion

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.

Please Log in or Create an account to join the conversation.

More
2 years 2 months ago #142408 by jelo
jelo replied the topic: Multiple Choice Question Type - Moving the Other subquestion

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

I too ;-)

Are you a student conducting a survey? If yes, tell me why you use LimeSurvey?
www.limesurvey.org/forum/development/116...y-you-use-limesurvey

Please Log in or Create an account to join the conversation.

More
2 years 2 months ago #142480 by markladius
markladius replied the topic: Multiple Choice Question Type - Moving the Other subquestion
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

Please Log in or Create an account to join the conversation.

More
2 years 2 months ago - 2 years 2 months ago #142481 by jelo
jelo replied the topic: Multiple Choice Question Type - Moving the Other subquestion

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?

Are you a student conducting a survey? If yes, tell me why you use LimeSurvey?
www.limesurvey.org/forum/development/116...y-you-use-limesurvey
Attachments:
Last Edit: 2 years 2 months ago by jelo.

Please Log in or Create an account to join the conversation.

More
2 years 1 month ago - 2 years 1 month ago #143289 by kwalker
kwalker replied the topic: Multiple Choice Question Type - Moving the Other subquestion
I tried the JS from http://www.limesurvey-consulting.com/how-to-re-order-the-other-option-at-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: http://hsprn.hostedincanadasurveys.ca/index.php/948713?lang=en
Last Edit: 2 years 1 month ago by kwalker.

Please Log in or Create an account to join the conversation.

More
2 years 1 month ago - 2 years 1 month ago #143295 by Joffm
Joffm replied the topic: Multiple Choice Question Type - Moving the Other subquestion
Hi,
I am not able to solve the problem, but I know where there is the issue.

Here the code of the "Other" Item:
<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
<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: 2 years 1 month ago by Joffm. Reason: Ergänzung
The following user(s) said Thank You: kwalker

Please Log in or Create an account to join the conversation.

More
2 years 1 month ago #143310 by Mazi
Mazi replied the topic: Multiple Choice Question Type - Moving the Other subquestion

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
Contact: marcel.minke(at)survey-consulting.com
Want to use your survey offline -> www.offlinesurveys.com

Please Log in or Create an account to join the conversation.

More
2 years 1 month ago #143321 by tpartner
tpartner replied the topic: Multiple Choice Question Type - Moving the Other subquestion

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

<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.
Attachments:
The following user(s) said Thank You: kwalker

Please Log in or Create an account to join the conversation.

More
2 years 1 month ago #143357 by Mazi
Mazi replied the topic: Multiple Choice Question Type - Moving the Other subquestion

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
Contact: marcel.minke(at)survey-consulting.com
Want to use your survey offline -> www.offlinesurveys.com
The following user(s) said Thank You: kwalker

Please Log in or Create an account to join the conversation.

More
2 years 1 month ago #143391 by kwalker
kwalker replied the topic: Multiple Choice Question Type - Moving the Other subquestion
Thanks everyone for your help!

If you want to modify the original script from Dr. Minke, I think this should work:

<script type='text/javascript'>
$(document).ready(function() {

var move_element="other";
var place_before="8";

var place_before=("javatbd{SGQ}"+place_before);
var move_element="javatbd{SGQ}"+move_element;
var parent_before=$("#"+place_before).parent();

$("#"+move_element).parent().insertBefore(parent_before);

});
</script>

Please Log in or Create an account to join the conversation.

More
2 years 1 month ago #143786 by midRange
midRange replied the topic: Multiple Choice Question Type - Moving the Other subquestion
Hello, great solutions here. Very helpful and many thanks. I have a question about a List (Radio) type question and how to move the other button around like the above solutions. I have tried the JS on a List (Radio) type question, but I am unable to move the Other option to where I want. Any suggestions?

Please Log in or Create an account to join the conversation.

More
2 years 1 month ago #143787 by midRange
midRange replied the topic: Multiple Choice Question Type - Moving the Other subquestion
Disregard my post above. I simply had to modify the JS script to account for the different HTML on the List (Radio) Type page.
Removed .parent() from variables otherRow and replaceRow

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

$(replaceRow).before($(otherRow));
});
</script>

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!