Array filter->Multiple question->array single question empty radio button

More
3 years 8 months ago #106274 by jajas
jajas created the topic: Array filter->Multiple question->array single question empty radio button
Dear Limesurvey Team,

I have 2 question:

1st Question

Q1. Which Gadget do you have [multiple answer]
A1. Smart Phone
A2. Tablet
A3. Google Glass
A4. Smart Watch
A5. Other___________ ==> other is blank

Q2. Please Rate minimum 3 item gadget the most important for you [Array][single]
1st Rate
2nd Rate
3rd Rate---
Smart phone O O O
Tablet O O O
O O O

i was use array filter to make previous answer and in previous question [Q1]
shown base on previous selected answer, and it's work properly.


the problem is, when other in Q1 is empty (blank), blank radio button shown
in Q2. when i add other in Q2 as Answer code for Other rised message :
Error: 'other' is a reserved keyword.



the question is, How to prevent empty radio button in next question [for array question type]
if "Other" in previous answer is empty or blank,
without show Message Error: 'other' is a reserved keyword.

Need help for this case, please..

attached sample file, but without "other" answer code in Q2

Thanks,

JajaS
Attachments:

Please Log in to join the conversation.

More
3 years 8 months ago #106277 by jajas
jajas replied the topic: Array filter->Multiple question->array single question empty radio button
somebody Help me..

Please Log in to join the conversation.

More
3 years 8 months ago #106287 by tpartner
tpartner replied the topic: Array filter->Multiple question->array single question empty radio button
Please read the forum rules - NO double posting!

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

Please Log in to join the conversation.

More
3 years 8 months ago #106321 by jajas
jajas replied the topic: Array filter->Multiple question->array single question empty radio button
Hi Tony,

this is no double posting.

1st Posting is my question about prevent empty radio button if 1st Multiple question and 2nd question is Single Question


this posting i asked about prevent empty radio button if 1st Multiple question and 2nd Question is Array Single Question.
:)

by the way, sorry if i'm breaking the rule. i did not read the forum rule yet. :)

Regards,

JajaS

Please Log in to join the conversation.

More
3 years 8 months ago #106325 by tpartner
tpartner replied the topic: Array filter->Multiple question->array single question empty radio button

this is no double posting...1st Posting is my question about prevent empty radio button if 1st Multiple question and 2nd question is Single Question

I am referring to this post - www.limesurvey.org/en/forum/can-i-do-thi...n-empty-radio-button .

Regarding your problem, are the two questions to be displayed on separate pages?


.

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

Please Log in to join the conversation.

More
3 years 8 months ago #106326 by jajas
jajas replied the topic: Array filter->Multiple question->array single question empty radio button
Hi Tony,

I Tried this in separate pages and single page, and the problem is the same.
in .lsg attached file can find sample that i made. For 2nd Question it should be answer
with other Option. but i can't add Other option because raised message Error: 'other' is a reserved keyword., so i didn't fill Other Answer in Q2 (2nd question).

Regards,

JajaS

Please Log in to join the conversation.

More
3 years 8 months ago #106327 by tpartner
tpartner replied the topic: Array filter->Multiple question->array single question empty radio button
The solutions will be different for single page or separate pages so I need to know which way you intend to display the survey.

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

Please Log in to join the conversation.

More
3 years 8 months ago #106328 by jajas
jajas replied the topic: Array filter->Multiple question->array single question empty radio button
Hi Tony,

At this time i use in separate pages.

by the way, if there is solution for both, it's will be better

Regards,

JajaS

Please Log in to join the conversation.

More
3 years 8 months ago #106338 by tpartner
tpartner replied the topic: Array filter->Multiple question->array single question empty radio button
Here is a solution for separate pages. A solution for a single page would require quite a bit more code.

1) Add an "N/A" option to the array Y axis. We will hide this column and automatically click it when we hide the "Other" row, allowing us to meet the "mandatory" requirement.

2) Use Expression Manager to pipe the "Other" text from Q1 into the label for the "Other" row of the array - see screenshot below.

3) Add this script to the source of the array question. It will hide the "Other" row and click the "N/A" option if it has no label.

<script type="text/javascript" charset="utf-8">	
	$(document).ready(function(){	
 
		// Identify this question 
		var thisQuestion = $('#question{QID}');
 
		// Hide the "N/A" column 
		$('table.question thead th:last', thisQuestion).hide();
		$('tr.answers-list', thisQuestion).each(function(i) {
			$('td:last', this).hide();
		});
 
		// If the last row has no label text, hide it and click the hidden "N/A" option
		if($.trim($('tr.answers-list:last .answertext', thisQuestion).text()).length == 0) {
			$('tr.answers-list:last input.radio:last', thisQuestion).prop('checked', true);
			$('tr.answers-list:last', thisQuestion).hide();
		}
		else {
			$('tr.answers-list:last input.radio:last', thisQuestion).prop('checked', false);
		}
	});
</script>

A working sample survey:

File Attachment:

File Name: limesurvey...4678.lss
File Size:20 KB



Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:

Please Log in to join the conversation.

More
3 years 8 months ago #106397 by jajas
jajas replied the topic: Array filter->Multiple question->array single question empty radio button
Hi Tony,

it's works! you are the best![two thumbs up]
Thanks for Help.

How about solution for a single page?
i have to make new question topic or can continue this topic?

cheers,
JajaS

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!