- Posts: 57
- Thank you received: 3
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
"Exclusive option" in array
- delarammahdaviii
- Topic Author
- Offline
- Senior Member
Less
More
8 years 2 months ago #130390
by delarammahdaviii
"Exclusive option" in array was created by delarammahdaviii
hi
thanks for
i want use "Exclusive option" in array but for answer code , not for subquestion code
how can do it ?
thanks for
i want use "Exclusive option" in array but for answer code , not for subquestion code
how can do it ?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10103
- Thank you received: 3593
8 years 2 months ago #130395
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic "Exclusive option" in array
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.
The topic has been locked.
- delarammahdaviii
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 57
- Thank you received: 3
8 years 2 months ago - 8 years 2 months ago #130397
by delarammahdaviii
Replied by delarammahdaviii on topic "Exclusive option" in array
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: 8 years 2 months ago by delarammahdaviii.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10103
- Thank you received: 3593
8 years 2 months ago #130399
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic "Exclusive option" in array
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.
The topic has been locked.
- delarammahdaviii
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 57
- Thank you received: 3
8 years 2 months ago #130400
by delarammahdaviii
Replied by delarammahdaviii on topic "Exclusive option" in array
Just for column D
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10103
- Thank you received: 3593
8 years 2 months ago - 8 years 2 months ago #130407
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic "Exclusive option" in array
In that case, adding this script to the question source should do the trick:
Sample survey attached.
Code:
<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.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
Last edit: 8 years 2 months ago by tpartner.
The following user(s) said Thank You: delarammahdaviii
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13633
- Thank you received: 2490
8 years 2 months ago - 8 years 2 months ago #130445
by DenisChenu
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 .
I don't answer to private message.
Replied by DenisChenu on topic "Exclusive option" in array
ANd with EM (for PHP validation too (user deactivated javascript)
Question validation equation
Question validation equation
Code:
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 .
I don't answer to private message.
Last edit: 8 years 2 months ago by DenisChenu.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10103
- Thank you received: 3593
8 years 2 months ago - 8 years 2 months ago #130462
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic "Exclusive option" in array
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.
Last edit: 8 years 2 months ago by tpartner.
The following user(s) said Thank You: delarammahdaviii
The topic has been locked.
- Mazi
- Offline
- Official LimeSurvey Partner
8 years 2 months ago #130469
by Mazi
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
Replied by Mazi on topic "Exclusive option" in array
Denis, is that a custom validation for making sure that at the whole question option "d" is used only once?DenisChenu wrote: ANd with EM (for PHP validation too (user deactivated javascript)
Question validation equationCode:countif("d",self.NAOK) <= 1
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13633
- Thank you received: 2490
8 years 2 months ago #130500
by DenisChenu
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 .
I don't answer to private message.
Replied by DenisChenu on topic "Exclusive option" in array
YesMazi wrote: ....
Denis, is that a custom validation for making sure that at the whole question option "d" is used only once?
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.tpartner wrote: Yeah but I think the user experience with disabled radios is better.
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 .
I don't answer to private message.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10103
- Thank you received: 3593
8 years 2 months ago #130506
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic "Exclusive option" in array
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.
The topic has been locked.
- delarammahdaviii
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 57
- Thank you received: 3
8 years 2 months ago - 8 years 2 months ago #130530
by delarammahdaviii
Replied by delarammahdaviii on topic "Exclusive option" in array
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
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: 8 years 2 months ago by delarammahdaviii.
The topic has been locked.