drop down option list

More
9 months 2 weeks ago #187756 by kapil_codefire
can we do like this?

I have 5 options for a dropdown list and it's for 5 questions when any option selected that will not come on next question option.

Example:
I have 5 options
1. option 1
2. option 2
3. option 3
4. option 4
5. None

When I first question select 1st option then it's will not come on 2nd question options list, and when 2nd question I select 4th option then next question 1st and 4th option will not come on 3rd question option.

Please Log in to join the conversation.

LimeSurvey Partners
More
9 months 2 weeks ago #187774 by tpartner
Replied by tpartner on topic drop down option list
There is no filtering available for list-dropdown questions.

If you use list-radio questions and your questions are in separate groups, you could filter them with hidden multiple-choice questions that you set via Expression Manager.

Searching the forums should yield many examples presented by Joffm on how to do that.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com

Please Log in to join the conversation.

More
9 months 2 weeks ago #187775 by kapil_codefire
Hi tpartner, thank you for the answer, can we do this using javascript?

Please Log in to join the conversation.

More
9 months 2 weeks ago #187776 by Joffm
Replied by Joffm on topic drop down option list
As Tony said: I explained the way I do it several times

Here is an example to do what you described

File Attachment:

File Name: limesurvey...8-19.lss
File Size:31 KB



But, of course: no drop-down. But I do not think this is a severe issue with only 5 options.

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:

Please Log in to join the conversation.

More
9 months 2 weeks ago #187777 by tpartner
Replied by tpartner on topic drop down option list

Hi tpartner, thank you for the answer, can we do this using javascript?


Yes, I suppose you could do it with JavaScript.

Are all questions on the same page?

Do you allow backward navigation in the survey?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com

Please Log in to join the conversation.

More
9 months 2 weeks ago #187779 by kapil_codefire
Are all questions on the same page?
==>
No, each question on different page

Do you allow backward navigation in the survey?
==>
Yes

Please Log in to join the conversation.

More
9 months 2 weeks ago #187782 by tpartner
Replied by tpartner on topic drop down option list
In that case if, for example, you have question codes Q1, Q2, Q3, disable AJAX in the survey theme options and place a script like this in the source of Q2:

<script type="text/javascript" charset="utf-8">
 
	$(document).on('ready pjax:scriptcomplete',function(){
 
		// Define the previous answer(s)
		var q1Value = '{Q1}';
 
		// Identify the drop-down
		var thisSelect = $('#question{QID} select.form-control:eq(0)');
 
		// Reset the drop-down if its value equals previous answer(s)
		if(thisSelect.val() == q1Value) {
			if($('option[value=""]', thisSelect).length == 0) {
				$(thisSelect).prepend('<option value="">Please choose...</option>');
			}
 
			thisSelect.val('');
		}
 
		// Remove drop-down option
		$('option[value="'+q1Value+'"]', thisSelect).remove();
	});
</script>

Place a script like this in the source of Q3:

<script type="text/javascript" charset="utf-8">
 
	$(document).on('ready pjax:scriptcomplete',function(){
 
		// Define the previous answer(s)
		var q1Value = '{Q1}';
		var q2Value = '{Q2}';
 
		// Identify the drop-down
		var thisSelect = $('#question{QID} select.form-control:eq(0)');
 
		// Reset the drop-down if its value equals previous answer(s)
		if(thisSelect.val() == q1Value || thisSelect.val() == q2Value) {
			if($('option[value=""]', thisSelect).length == 0) {
				$(thisSelect).prepend('<option value="">Please choose...</option>');
			}
 
			thisSelect.val('');
		}
 
		// Remove drop-down options
		$('option[value="'+q1Value+'"]', thisSelect).remove();
		$('option[value="'+q2Value+'"]', thisSelect).remove();
	});
</script>

Sample survey attached:

File Attachment:

File Name: limesurvey...8-19.lss
File Size:42 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Attachments:

Please Log in to join the conversation.

More
9 months 2 weeks ago #187788 by kapil_codefire
Hi Joffm,

thank you reply, I trying it as you mentioned, but when I click on back button then it's selected option not showing
an example:
Q1. option1 selected
Q2. option2 selected (option1 not showing)
Q3. option4 selected (option1 & option2 not showing)

When I click on back button from Q3 then Q2 option2 not showing.

Please Log in to join the conversation.

More
9 months 2 weeks ago #187789 by kapil_codefire
Hi Tpartner,
Thank you very much, it's working fine that as I need.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now