Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Array Question with "Other" Answer

Array Question with "Other" Answer 3 months 2 weeks ago #107415

  • jajas
  • jajas's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 32
  • Karma: 0
Dear LS Team,

I have matrix question and in LS i choose Array Question Type.
but in this question i need add "Other" Option for sub question.

HOw to add "Other" Option to array (matrix) question type?

Regards,

JajaS
The administrator has disabled public write access.

Array Question with "Other" Answer 3 months 2 weeks ago #107418

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6235
  • Thank you received: 793
  • Karma: 238
Hi,

You can add a sub question, code OTHE (for example), if you need other comment :adding a question text with condition !is_empty(QQ_OTHE)

Denis
The administrator has disabled public write access.

Array Question with "Other" Answer 3 months 2 weeks ago #107422

  • jajas
  • jajas's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 32
  • Karma: 0
Hi Denis,

i'm not clear with your explanation.
can you give me an example for this case, please

Jajas
The administrator has disabled public write access.

Array Question with "Other" Answer 3 months 2 weeks ago #107427

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
You can add a multiple-short-text question after the array and use JavaScript to move the text inputs into the array.

Here is a similar solution - www.limesurvey.org/en/forum/design-issue...to-text-input#102550.


.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 3 months 2 weeks ago by tpartner.
The administrator has disabled public write access.

Array Question with "Other" Answer 3 months 2 weeks ago #107571

I need to understand this as well. Been poking around these forums and there's too much assumed about one's coding ability. Please answer as if to a simpleton.

In any case, you link to a different kind of answer. The example in your link is to add text input fields into the answer fields of an array.

The OP in this thread, and myself, don't want to do anything fancy to the answer fields, just add one more subquestion to the array of "other" with an input ... the answers remain the same.

So for instance, how do you feel about the following bands/musicians?

array_w_other.jpg
The administrator has disabled public write access.

Array Question with "Other" Answer 3 months 1 week ago #107603

  • trivender
  • trivender's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 139
  • Thank you received: 5
  • Karma: 5
I can do it for you if you can give me link to the page. Please note that survey should have group by group display so that I can add an additional hidden short free text question below your array type question.
Trivender Singh
Survey Designer and Programmer
"I always suggest to have a group by group display layout and create a seprate group for each question. This will be extra work but you will get flexiblity to create your question by using more than more lime survey question types."
The administrator has disabled public write access.

Array Question with "Other" Answer 3 months 1 week ago #107719

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
Here is a small script that when placed in the source of an array question will:

1) Identify and hide a following short-text question
2) Move the text input from that hidden question into the last subquestion of the array as depicted above

<script type="text/javascript" charset="utf-8">	
 
	$(document).ready(function() {
 
		// Identify the questions
		var q1 = $('#question'+{QID}+'');
		var q2 = $(q1).nextAll('.text-short:eq(0)');
 
		// Hide the short-text question
		$(q2).hide();
 
		// Move the hidden text input into the array
		$('th.answertext:last', q1).append($('input[type="text"]', q2));
 
		// Some styling...
		$('input[type="text"]', q1).css({
			'width': '50%'
		});
	});
</script>

Here's a working sample for 2.05:

File Attachment:

File Name: limesurvey_survey_733296.lss
File Size: 17 KB
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Array Question with "Other" Answer 3 months 1 week ago #107747

  • trivender
  • trivender's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 139
  • Thank you received: 5
  • Karma: 5
@tpartner : You write very nice generic jquery :). I have a suggestion in your code. Please append an error below below question text and do not let user to continue (return false on submit) if user try to pass question leaving textbox empty and choosing a radio button in the same row or vice versa.
Trivender Singh
Survey Designer and Programmer
"I always suggest to have a group by group display layout and create a seprate group for each question. This will be extra work but you will get flexiblity to create your question by using more than more lime survey question types."
The administrator has disabled public write access.

Array Question with "Other" Answer 3 months 1 week ago #107748

  • trivender
  • trivender's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 139
  • Thank you received: 5
  • Karma: 5
and the code should be placed in workarounds because having an other specify in array questions in very common requirement.
Trivender Singh
Survey Designer and Programmer
"I always suggest to have a group by group display layout and create a seprate group for each question. This will be extra work but you will get flexiblity to create your question by using more than more lime survey question types."
The administrator has disabled public write access.

Array Question with "Other" Answer 3 months 1 week ago #107751

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
Hi Trivender, thanks for the suggestion. I thought of that but there are a couple of behaviour issues to be considered...

1) What if the respondent changes their mind about "Other". There is no way to deselect a radio. I suppose we could put a listener on the text input to deselect all radios in that row if a keyup event detects no value in the text input but that's not entirely intuitive. Maybe a "Clear" button?.

2) How to handle mandatory questions? Maybe a hidden "N/A" column?

Your thoughts?

.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 3 months 1 week ago by tpartner.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.177 seconds
Donation Image