Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Choix multiples_Réponses contradictoire_Indication de validation de la question

  • margot1234
  • margot1234's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 months 23 hours ago #251575 by margot1234
Bonjour. 

J'ai une question à choix multiples de type. J'aimerai empêcher les répondants de cocher une réponse en particulier s'ils ont coché une autre qui est contradictoire. 

Ex: 

- a
- b 
- c
- d

Je veux empêcher le répondant de cocher b s'il a déjà coché a et inversement je veux l'empêcher de cocher a s'il a coché b. Comment est-ce que je peux faire cela ? 

Je suppose que je dois indiqué une équation dans la validation de la question mais je n'y parviens pas...

Merci! 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 22 hours ago #251577 by Joffm
Please, English in this part of the forum.

Or use the French part.

Joffm

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

Please Log in to join the conversation.

  • margot1234
  • margot1234's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 months 22 hours ago #251578 by margot1234
Hello. Sorry I don't know that. So,

I have a multiple choice question. I would like to block respondents from checking a particular answer if they have checked another that is contradictory.

Ex:

- a
- b
- c
- d

I want to stop the respondent from ticking b if he has already ticked a and inversely I want to stop him ticking a if he has ticked b. How can I do this?

I suppose I need to enter an equation in the question validation, but I can't manage it...

Thanks for your help!

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 22 hours ago #251579 by Joffm
Hi, the easy solution is to validate

Here two validations:
a. !(Q1_SQ001.NAOK=="Y" and Q1_SQ002.NAOK=="Y")   not both selected
b. count(Q1_SQ001.NAOK,Q1_SQ002.NAOK)<2  the number of selected items is less than 2, so only one of them or none

There might be more  solutions by javascript, which disable a subquestion if the other one was selected.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

  • margot1234
  • margot1234's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 months 22 hours ago #251580 by margot1234
Thanks. That's what I tried but I got an error message... (error 403)
Attachments:

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 22 hours ago #251581 by Joffm
What image is this?
If you get an error message, please send the lss export

Joffm 

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

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Online
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 20 hours ago #251583 by holch
This seems to be a custom 403 error message from your server.

HTTP 403 is an HTTP status code meaning access to the requested resource is forbidden.


You need to check with your server admin.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Please Log in to join the conversation.

  • margot1234
  • margot1234's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 months 18 hours ago #251584 by margot1234
Ok, I'm going to check. Thank you for your help!

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 months 4 weeks ago #251669 by tpartner

There might be more  solutions by javascript, which disable a subquestion if the other one was selected.
This small script, placed in the source of a multiple-choice question, will render various answer items as exclusive by disabling other exclusive items.

Modify the values in the exclusiveCodes array as necessary.

Code:
<script type="text/javascript" data-author="Tony Partner">
 
  $(document).on('ready pjax:scriptcomplete',function(){
 
    // Define the exclusive sub-question codes
    var exclusiveCodes = [
      'SQ001',
      'SQ002'
    ];
 
    // Identify this question
    var qID = '{QID}';
    var thisQuestion = $('#question'+qID);
 
    // Add some classes
    $.each(exclusiveCodes, function(i, code) {
      $(':checkbox[id$="X'+qID+code+'"]', thisQuestion).addClass('exclusive-input');
    });
 
    // Listener on the exclusive items
    $(':checkbox.exclusive-input', thisQuestion).on('change', function(e) {
       handleExclusive(thisQuestion);
    });
 
    // Returning to the page
     handleExclusive(thisQuestion);
  });
 
  // A function to handle the exclusive items
  function handleExclusive(thisQuestion) {
    $(':checkbox.exclusive-input', thisQuestion).prop('disabled', false);
 
    if($(':checkbox.exclusive-input:checked', thisQuestion).length > 0) {
      $(':checkbox.exclusive-input:not(:checked)', thisQuestion).prop('disabled', true);
    }
  }
</script>



Sample survey attached:  

File Attachment:

File Name: limesurvey...9853.lss
File Size:34 KB

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.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 months 3 weeks ago - 5 months 3 weeks ago #251722 by DenisChenu
No need javascript,
Included in expression + attribute : demo.sondages.pro/561662?newtest=Y&lang=en
 

 

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: 5 months 3 weeks ago by DenisChenu.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 months 3 weeks ago #251737 by tpartner
Sure, if you want to modify the display rules for irrelevant items.

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.

Lime-years ahead

Online-surveys for every purse and purpose