Welcome, Guest
Username: Password: Remember me

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

Array filter->Multiple question->array single question empty radio button 4 months 2 weeks ago #106274

  • jajas
  • jajas's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 32
  • Karma: 0
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:
The administrator has disabled public write access.

Array filter->Multiple question->array single question empty radio button 4 months 2 weeks ago #106277

  • jajas
  • jajas's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 32
  • Karma: 0
somebody Help me..
The administrator has disabled public write access.

Array filter->Multiple question->array single question empty radio button 4 months 2 weeks ago #106287

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
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.

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 filter->Multiple question->array single question empty radio button 4 months 2 weeks ago #106321

  • jajas
  • jajas's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 32
  • Karma: 0
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
The administrator has disabled public write access.

Array filter->Multiple question->array single question empty radio button 4 months 2 weeks ago #106325

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
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.

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 filter->Multiple question->array single question empty radio button 4 months 2 weeks ago #106326

  • jajas
  • jajas's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 32
  • Karma: 0
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
The administrator has disabled public write access.

Array filter->Multiple question->array single question empty radio button 4 months 2 weeks ago #106327

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
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.

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 filter->Multiple question->array single question empty radio button 4 months 2 weeks ago #106328

  • jajas
  • jajas's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 32
  • Karma: 0
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
The administrator has disabled public write access.

Array filter->Multiple question->array single question empty radio button 4 months 2 weeks ago #106338

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
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_survey_924678.lss
File Size: 20 KB


Capture_2014-03-14.png
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 filter->Multiple question->array single question empty radio button 4 months 2 weeks ago #106397

  • jajas
  • jajas's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 32
  • Karma: 0
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
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.124 seconds
Donation Image