"Exclusive option" in array

More
3 years 11 months ago #130390 by delarammahdaviii
hi
thanks for
i want use "Exclusive option" in array but for answer code , not for subquestion code
how can do it ?

Please Iniciar sessão or Create an account to join the conversation.

LimeSurvey Partners
More
3 years 11 months ago #130395 by tpartner
Sorry, I don't understand the question. In an array, the answer options are already exclusive because they're radios.

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 Iniciar sessão or Create an account to join the conversation.

More
3 years 11 months ago - 3 years 11 months ago #130397 by delarammahdaviii
In an array (single choice per rows); i want choice answer in column , if one of the answer in D column is choose , another rows can't choose the answer D column .
Attachments:
Last edit: 3 years 11 months ago by delarammahdaviii.

Please Iniciar sessão or Create an account to join the conversation.

More
3 years 11 months ago #130399 by tpartner
Just for column D, or for all columns?

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 Iniciar sessão or Create an account to join the conversation.

More
3 years 11 months ago #130400 by delarammahdaviii
Just for column D

Please Iniciar sessão or Create an account to join the conversation.

More
3 years 11 months ago - 3 years 11 months ago #130407 by tpartner
In that case, adding this script to the question source should do the trick:

<script type="text/javascript" charset="utf-8">		
	$(document).ready(function() {	
 
		// Identify this question
		var thisQuestion = $('#question{QID}');
 
		// Assign column-specific classes
		$('table.subquestions-list tr', thisQuestion).each(function(i){
			$('> *', this).each(function(i){
				$(this).addClass('column-'+i+'');
				$(this).attr('data-column', i);
			});
		});
 
		// Define the column to have exclusive answers
		var exclusiveColumn = 4;
 
		// Listeners on the radios
		$('input.radio', thisQuestion).on('click', function(e) {
			var thisCell = $(this).closest('td');
			if($(thisCell).hasClass('column-'+exclusiveColumn)) {
				setTimeout(function () {
					$('.column-'+exclusiveColumn+' input.radio:not(:checked)', thisQuestion).prop('disabled', true);
				}, 100);
			}
			if($('.column-'+exclusiveColumn+' input.radio:checked', thisQuestion).length == 0) {
				$('.column-'+exclusiveColumn+' input.radio', thisQuestion).prop('disabled', false);
			}
		});
 
		// Initial radio state
		if($('.column-'+exclusiveColumn+' input.radio:checked', thisQuestion).length != 0) {
			$('.column-'+exclusiveColumn+' input.radio:not(:checked)', thisQuestion).prop('disabled', true);
		}
    });
</script>

Sample survey attached.

File Attachment:

File Name: limesurvey...47-2.lss
File Size:21 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:
Last edit: 3 years 11 months ago by tpartner.
The following user(s) said Thank You: delarammahdaviii

Please Iniciar sessão or Create an account to join the conversation.

More
3 years 11 months ago - 3 years 11 months ago #130445 by DenisChenu
ANd with EM (for PHP validation too (user deactivated javascript)

Question validation equation
countif("d",self.NAOK) <= 1

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
An error happen ? Before make a new topic : remind the Debug mode .
Last edit: 3 years 11 months ago by DenisChenu.

Please Iniciar sessão or Create an account to join the conversation.

More
3 years 11 months ago - 3 years 11 months ago #130462 by tpartner
Yeah but I think the user experience with disabled radios is better. :)

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Last edit: 3 years 11 months ago by tpartner.
The following user(s) said Thank You: delarammahdaviii

Please Iniciar sessão or Create an account to join the conversation.

More
3 years 11 months ago #130469 by Mazi
Replied by Mazi on topic "Exclusive option" in array

DenisChenu wrote: ANd with EM (for PHP validation too (user deactivated javascript)

Question validation equation

countif("d",self.NAOK) <= 1

Denis, is that a custom validation for making sure that at the whole question option "d" is used only once?

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 Iniciar sessão or Create an account to join the conversation.

More
3 years 11 months ago #130500 by DenisChenu

Mazi wrote: ....
Denis, is that a custom validation for making sure that at the whole question option "d" is used only once?

Yes

tpartner wrote: Yeah but I think the user experience with disabled radios is better. :)

Sure, but : need a PHP control :). Else a user can decativate JS (or js can be broken for some reason ;) ) and false value in DB.

I try always to
- Add specific desired behaviour in EM first
- Add some js for user experience
:)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
An error happen ? Before make a new topic : remind the Debug mode .

Please Iniciar sessão or Create an account to join the conversation.

More
3 years 11 months ago #130506 by tpartner
Well, with JavaScript disabled LimeSurvey is almost useless anyway - there is no dynamic filtering or EM.

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 Iniciar sessão or Create an account to join the conversation.

More
3 years 11 months ago - 3 years 11 months ago #130530 by delarammahdaviii
hi
tnx all for reply:) :) :)


i so sorry this case is change
if one of the D column is select ; C and B else disable .user only can select from A or E
Attachments:
Last edit: 3 years 11 months ago by delarammahdaviii.

Please Iniciar sessão or Create an account to join the conversation.

More
5 months 1 day ago #187895 by EnricoCaruso
The script and sample survey currently do not work with LimeSurvey version 3.17.9. I can not find what's going on. Maybe there is a version conflict here.

Please Iniciar sessão or Create an account to join the conversation.

More
5 months 1 day ago - 5 months 1 day ago #187902 by Joffm
Replied by Joffm on topic "Exclusive option" in array

Maybe there is a version conflict here.

Yes, this is very probable.
This thread ended three and a half years ago and the screenshot shows a template of version 2.05 / 2.06 (I think)

So please add your sample survey as *.lss, explain what you want to do, and we will try to find a solution.

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
Last edit: 5 months 1 day ago by Joffm.
The following user(s) said Thank You: EnricoCaruso

Please Iniciar sessão or Create an account to join the conversation.

More
5 months 17 hours ago #187934 by EnricoCaruso
A rating of individual statements is required, with simultaneous distribution of the ranking (exclusive answer per column, except last column). The script from tpartner tpartner on topic Need a replacement for Ranking Questionhere

File Attachment:

File Name: limesurvey...5517.lss
File Size:31 KB
goes in the right direction, only it works for all columns. I can not get an exception for the last column. The solution in this forum where the individual Exclusive columns can be specified is good, but it does not work.
Attachments:

Please Iniciar sessão or Create an account to join the conversation.

Começar agora!

Basta criar a sua conta e comece a usar o LimeSurvey hoje mesmo.

Registar agora
Subscreva o nosso boletim informativo!

Iniciar sessão