Welcome to the LimeSurvey Community Forum

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

Randomize multi punch question items in blocks with exclusive option

  • LookingforSolution
  • LookingforSolution's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 6 months ago #205853 by LookingforSolution
Hello,

I would like to randomize multi punch question items in blocks. I do have an exclusive option (always at the end) and a not open "other" option (at the second last position):

A--> Block 1
B--> Block 1
C--> Block 1
D--> Block 2
E--> Block 2
F--> Block 2
G--> Block 3
Other-->Block 3
Exclusive--> Block 3


For that reason, I created separate questions for every item-block (1st question with question text, others without) within the same question group and added the same randomization group name for all questions.

I used the follwing skripts:

1. For first question Block1 (items with question text):
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$('#question{QID}').addClass('no-bottom');
});
</script>

2. for following question Block 2-3 (only items, no question text):

<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$('#question{QID}').addClass('no-question');
$('#question{QID}').addClass('no-bottom');
});
</script>

The problems are the following:

1. I want the questions always to be answered, but I can only put every question for itself as obligatory. This means one item of every question has to be selected, which does not always make sense.
2. If the exclusive option is selected ALL other items from all questions of this group should be grayed out. This right now only applies to items, which are in the same block.

Could you maybe help?
Thanks in advance!

File Attachment:

File Name: limesurvey...3629.lss
File Size:28 KB
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 6 months ago - 3 years 6 months ago #205866 by Joffm
Hi,
it is much better to open a new topic instead of adding this question at the end of an old thread.

1. Instead of your javascript enter the used classes (.no-bottom,...) in "Display / css classes".

2. My proposal is:
Remove all mandatory settings, all "exclusive" settings and validate the first question (Q33).
Something like:
count(self,that.Q33Medien,that.Q33Umfeld,that.Q33Erfahrung,that.Q33Ende)>0
to check that there is at least one item selected.

Now you only have to extend this to validate that Q22Ende_12 is exclusive.

And a descriptive tip.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 6 months ago by Joffm.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 6 months ago #205872 by Joffm
Hi, Sarah,
ich bin ja freundlich.

Well, here you get the full validation and a proposal for the tip:
question validation equation:
(count(self,that.Q33Medien,that.Q33Umfeld,that.Q33Erfahrung,that.Q33Ende)>0 AND Q33Ende_12!="Y") OR (count(self,that.Q33Medien,that.Q33Umfeld,that.Q33Erfahrung,that.Q33Ende)==1 AND Q33Ende_12=="Y")

question validation tip:
{if(count(self,that.Q33Medien,that.Q33Umfeld,that.Q33Erfahrung,that.Q33Ende)==0,"Bitte, mindestens eine Option wählen",if(count(self,that.Q33Medien,that.Q33Umfeld,that.Q33Erfahrung,that.Q33Ende)>1 and Q33Ende_12=="Y","'Exklusive' ist eine exklusive Option.",""))}

Of course you have to adapt the text to your needs.








Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: LookingforSolution
The topic has been locked.
  • LookingforSolution
  • LookingforSolution's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 6 months ago #205904 by LookingforSolution
Hi Joffm ,
thank you very much, this helped a lot!
The topic has been locked.
  • LookingforSolution
  • LookingforSolution's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 6 months ago #205923 by LookingforSolution
Now we have another problem with the question validation equation:

We do have one question where we have filters on specific items. In this case, the question validation equation does not work. Do you have an idea how to solve this?
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 6 months ago #205936 by Joffm
That's rather obvious.

If a subquestion is not displayed because of subquestion relevance its value is not defined.
So the validation equation will fail.
You have to use NAOK
manual.limesurvey.org/ExpressionScript_-...tation#Usage_of_NAOK

(count(self.NAOK, that.Q46Werbung.NAOK, that.Q46Lesen.NAOK, that.Q46Familie.NAOK, that.Q46Ende.NAOK)>0 AND Q46Ende_21!="Y")

Well, this validation equation is not complete. If you select Q46Ende_21 you will not be able to proceed.

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose