- Posts: 50
- Thank you received: 2
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
No repeat value in matrix question
- josegovia
- Topic Author
- Offline
- Senior Member
Less
More
10 years 8 months ago #97901
by josegovia
No repeat value in matrix question was created by josegovia
I have a question type array with five sub-questions. In each sub-question the respondent can put a value from 1 to 5.
I want to make the respondent put different values in each sub-question. For example, if the sub-question 1 put the value 3, in the sub-questions 2, 3, 4 and 5 he can not put the value 3.
How can you do this?
Thank you.
I want to make the respondent put different values in each sub-question. For example, if the sub-question 1 put the value 3, in the sub-questions 2, 3, 4 and 5 he can not put the value 3.
How can you do this?
Thank you.
The topic has been locked.
- mariays
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
10 years 2 months ago #102900
by mariays
Replied by mariays on topic No repeat value in matrix question
Hi,
I'm newbie in LS. I would like to know how to do no repeat value in matrix question?
Thanks.
I'm newbie in LS. I would like to know how to do no repeat value in matrix question?
Thanks.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3690
10 years 2 months ago #102904
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 No repeat value in matrix question
Which LimeSurvey version are you using?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- mariays
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
10 years 2 months ago #102949
by mariays
Replied by mariays on topic No repeat value in matrix question
Version 2.00+ Build 130108.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3690
10 years 2 months ago #102954
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 No repeat value in matrix question
Set up your survey to use JavaScript and add this script to the array question source:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // The error message var errorMsg = 'You can only select one answer per column'; // Identify the question var qID = {QID}; var thisQuestion = $('#question'+qID); // Listener on the radios $('.radio-item', thisQuestion).click(function(event) { // Check for more than one answer per column var answerCode = $(this).attr('class').split('answer_cell_00')[1].split(' ')[0]; if($('.answer_cell_00'+answerCode+' input[type="radio"]:checked', thisQuestion).length > 1) { alert(errorMsg); $('input[type="radio"]', this).attr('checked', false); } }); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- mariays
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
10 years 2 months ago #102988
by mariays
Replied by mariays on topic No repeat value in matrix question
Hi Tony,
I had added the script to the source of the array question, but still can't work. It should be have different answer on 1st, 2nd, 3th, 4th and 5th mention. Any suggestion? Thanks.
I had added the script to the source of the array question, but still can't work. It should be have different answer on 1st, 2nd, 3th, 4th and 5th mention. Any suggestion? Thanks.
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3690
10 years 2 months ago - 10 years 2 months ago #103013
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 No repeat value in matrix question
You indicated that you were using an
array question
, not an
array by column question
.
For an an array by column question use this script:
Here is your survey back with the amended script.
Having said all of that, I'm interested to know why you don't use a ranking question for this.
.
For an an array by column question use this script:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // The error message var errorMsg = 'You can only select one answer per row'; // Identify the question var qID = {QID}; var thisQuestion = $('#question'+qID); // Listener on the radios $('.radio-item', thisQuestion).click(function(event) { // Check for more than one answer per row var thisRow = $(this).closest('tr'); if($('input[type="radio"]:checked', thisRow).length > 1) { alert(errorMsg); $('input[type="radio"]', this).attr('checked', false); } }); }); </script>
Here is your survey back with the amended script.
Having said all of that, I'm interested to know why you don't use a ranking question for this.
.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
Last edit: 10 years 2 months ago by tpartner.
The following user(s) said Thank You: mariays
The topic has been locked.
- mariays
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
10 years 2 months ago #103029
by mariays
Replied by mariays on topic No repeat value in matrix question
Hi Tony,
Thanks a lot , it works. I use an array coloumn to match the query given by the client, it more about habit. Ranking can be an optional.
Thanks a lot , it works. I use an array coloumn to match the query given by the client, it more about habit. Ranking can be an optional.
The topic has been locked.