- Posts: 9
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Disable specific boxes (=answer options) in a array question (numbers)
- daveintausend
- Topic Author
- Offline
- New Member
Less
More
9 years 4 months ago #113888
by daveintausend
Replied by daveintausend on topic Disable specific boxes (=answer options) in a array question (numbers)
Hi Mazi,
the sample Survey can be found here: survey.lenze.com/limesurvey/index.php?sid=89417&lang=en
What do you mean by using the Array filter and placeholders for columns/rows? How do I do that?
the sample Survey can be found here: survey.lenze.com/limesurvey/index.php?sid=89417&lang=en
What do you mean by using the Array filter and placeholders for columns/rows? How do I do that?
The topic has been locked.
- Mazi
- Offline
- Official LimeSurvey Partner
9 years 4 months ago #113890
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 Disable specific boxes (=answer options) in a array question (numbers)
1. Which Limesurvey version are you using? Looks like an older one?!
2. Is that the shipped "default" template you are using or an edited template?
2. Is that the shipped "default" template you are using or an edited template?
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.
- daveintausend
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
9 years 4 months ago #113891
by daveintausend
Replied by daveintausend on topic Disable specific boxes (=answer options) in a array question (numbers)
1. Version 1.90+ Build 9642 - So Yes, it's an older one but I guess I have to live with that for the Moment
2. Not really sure. Thought this was the Default one since it's named that way in this Installation.
Anyway - don't want to cause too much trouble around here. Your version looks way nicer ofc, but I guess I could also live with the disabled boxes.
2. Not really sure. Thought this was the Default one since it's named that way in this Installation.
Anyway - don't want to cause too much trouble around here. Your version looks way nicer ofc, but I guess I could also live with the disabled boxes.
The topic has been locked.
- Mazi
- Offline
- Official LimeSurvey Partner
9 years 4 months ago #113893
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 Disable specific boxes (=answer options) in a array question (numbers)
The JS code doesn't work because it searches for the main HTML element enclosing the current question's code. At the later Limesurvey versions, each table or DIV holding the HTML elements of a certain question gets assigned the question ID. Obviously, this doesn't work for the old 1.90 version and thus the code fails.
Time for an update
Time for an update
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.
- daveintausend
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
9 years 4 months ago #113894
by daveintausend
Replied by daveintausend on topic Disable specific boxes (=answer options) in a array question (numbers)
Okay, that makes sense
I'll see if our IT guys are willing to update...
Thanks for your time and patience!
David
I'll see if our IT guys are willing to update...
Thanks for your time and patience!
David
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3691
9 years 4 months ago - 9 years 4 months ago #113905
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 Disable specific boxes (=answer options) in a array question (numbers)
If there is no filtering in the question and if it is the only array-numbers on the page and you are using the default template, you can try this:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Some classes and attributes $('.array-multi-flexi table.question thead tr > *').each(function(i){ $(this).attr('data-column', i); }); $('.array-multi-flexi table.question tbody tr').each(function(i){ $('> *', this).each(function(i){ $(this).attr('data-column', i); }); }); // Hide unnecessary selects $('.array-multi-flexi table.question tbody tr').each(function(i){ $('select:visible:lt('+i+')', this).hide(); $('select:visible:eq(0)', this).hide(); }); // Remove unecessary rows and columns $('.array-multi-flexi table.question tbody tr:last').hide(); $('.array-multi-flexi th[data-column="1"], td[data-column="1"]').hide(); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 9 years 4 months ago by tpartner.
The following user(s) said Thank You: daveintausend
The topic has been locked.
- daveintausend
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
9 years 4 months ago #113910
by daveintausend
Replied by daveintausend on topic Disable specific boxes (=answer options) in a array question (numbers)
Thanks a lot Tony, with the Default template this indeed seems to work aswell.
The topic has been locked.
- bdeprez
- Offline
- Senior Member
Less
More
- Posts: 53
- Thank you received: 5
6 years 9 months ago #155061
by bdeprez
Replied by bdeprez on topic Disable specific boxes (=answer options) in a array question (numbers)
Hi all,
This is a pretty old topic and I think it may no longer work the same... Or I'm doing something wrong (this is the most probable of the both).
I'm trying to hide a radio button in an array
The button I'm trying to hide is the following in my page source:
This is the script I am using:
What am I doing wrong? I tried the 'alert' test just to be sure that my javascript is on and that worked...
Thanks in advance for your help!
This is a pretty old topic and I think it may no longer work the same... Or I'm doing something wrong (this is the most probable of the both).
I'm trying to hide a radio button in an array
The button I'm trying to hide is the following in my page source:
Code:
<!-- answer_td --> <td class="answer-cell-3 answer_cell_A1 answer-item radio-item text-center radio"> <input class="radio" type="radio" name="783318X281X2223SQ001" value="A1" id="answer783318X281X2223SQ001-A1" onclick="checkconditions(this.value, this.name, this.type)" aria-labelledby="label-answer783318X281X2223SQ001-A1" /> <label for="answer783318X281X2223SQ001-A1" ></label> <!-- The label text is provided inside a div, so final user can add paragraph, div, or whatever he wants in the subquestion text This field is related to the input thanks to attribute aria-labelledby --> <div class="visible-xs-block label-text" id="label-answer783318X281X2223SQ001-A1"> Very Good </div> </td> <!-- end of answer_td -->
This is the script I am using:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('input.radio[name="783318X281X2223SQ001-A1"]').attr('hidden', 'hidden'); }); </script>
What am I doing wrong? I tried the 'alert' test just to be sure that my javascript is on and that worked...
Thanks in advance for your help!
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3691
6 years 9 months ago #155070
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 Disable specific boxes (=answer options) in a array question (numbers)
To avoid manipulating multiple radios, I would use the element ID as a selector. Also, to hide any pseudo-elements, I would hide or remove all of the radio's siblings.
Or:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#answer783318X281X2223SQ001-A1').closest('.answer-item').find('*').hide(); }); </script>
Or:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#answer783318X281X2223SQ001-A1').closest('.answer-item').find('*').remove(); }); </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.
- bdeprez
- Offline
- Senior Member
Less
More
- Posts: 53
- Thank you received: 5
6 years 9 months ago #155072
by bdeprez
Replied by bdeprez on topic Disable specific boxes (=answer options) in a array question (numbers)
Hi tpartner!
thank you very much for your response - I have a quick follow up question...
I had to change my array to an 'Array (numbers)' as I had to allow for multiple boxes to be checked for the same subquestion - that makes that my previous question no longer fits the purpose...
So, now I have 3 questions (X-axis) and 2 answers (Y-axis) which all can be selected with a checkbox.
This is the first "answer row":
How would I go and hide the second answer option?
Thank you very much!!!
thank you very much for your response - I have a quick follow up question...
I had to change my array to an 'Array (numbers)' as I had to allow for multiple boxes to be checked for the same subquestion - that makes that my previous question no longer fits the purpose...
So, now I have 3 questions (X-axis) and 2 answers (Y-axis) which all can be selected with a checkbox.
This is the first "answer row":
Code:
<!-- answer_row --> <tr id="javatbd783318X281X2231SQ001" class=" well subquestion-list questions-list array2 "> <th class="answertext col-xs-12 col-sm-6"> Voice <input type="hidden" name="java783318X281X2231SQ001" id="java783318X281X2231SQ001" value="" /> </th> <!-- answer_td_checkboxes --> <td class="answer-cell-6 answer_cell_SQ001 question-item answer-item checkbox-item checkbox-item checkbox text-center"> <input type="hidden" name="java783318X281X2231SQ001_SQ001" id="java783318X281X2231SQ001_SQ001" value="" /> <input type="hidden" name="783318X281X2231SQ001_SQ001" id="answer783318X281X2231SQ001_SQ001" value="" /> <input type="checkbox" class="checkbox " name="cbox_783318X281X2231SQ001_SQ001" id="cbox_783318X281X2231SQ001_SQ001" onclick=" cancelBubbleThis(event); aelt=document.getElementById('answer783318X281X2231SQ001_SQ001'); jelt=document.getElementById('java783318X281X2231SQ001_SQ001'); if(this.checked) { aelt.value=1; jelt.value=1; fixnum_checkconditions(1,'783318X281X2231SQ001_SQ001',aelt.type); } else { aelt.value=''; jelt.value=''; fixnum_checkconditions('','783318X281X2231SQ001_SQ001',aelt.type); } return true;" onchange="checkconditions(this.value, this.name, this.type)" aria-labelledby="label-cbox_783318X281X2231SQ001_SQ001" /> <label for="cbox_783318X281X2231SQ001_SQ001"></label> <!-- The label text is provided inside a div, so final user can add paragraph, div, or whatever he wants in the subquestion text This field is related to the input thanks to attribute aria-labelledby --> <div class="visible-xs-block label-text" id="label-cbox_783318X281X2231SQ001_SQ001"> Dealer to Dealer (D2D) </div> </td> <!-- end of answer_td_checkboxes --> <!-- answer_td_checkboxes --> <td class="answer-cell-6 answer_cell_SQ002 question-item answer-item checkbox-item checkbox-item checkbox text-center"> <input type="hidden" name="java783318X281X2231SQ001_SQ002" id="java783318X281X2231SQ001_SQ002" value="" /> <input type="hidden" name="783318X281X2231SQ001_SQ002" id="answer783318X281X2231SQ001_SQ002" value="" /> <input type="checkbox" class="checkbox " name="cbox_783318X281X2231SQ001_SQ002" id="cbox_783318X281X2231SQ001_SQ002" onclick=" cancelBubbleThis(event); aelt=document.getElementById('answer783318X281X2231SQ001_SQ002'); jelt=document.getElementById('java783318X281X2231SQ001_SQ002'); if(this.checked) { aelt.value=1; jelt.value=1; fixnum_checkconditions(1,'783318X281X2231SQ001_SQ002',aelt.type); } else { aelt.value=''; jelt.value=''; fixnum_checkconditions('','783318X281X2231SQ001_SQ002',aelt.type); } return true;" onchange="checkconditions(this.value, this.name, this.type)" aria-labelledby="label-cbox_783318X281X2231SQ001_SQ002" /> <label for="cbox_783318X281X2231SQ001_SQ002"></label> <!-- The label text is provided inside a div, so final user can add paragraph, div, or whatever he wants in the subquestion text This field is related to the input thanks to attribute aria-labelledby --> <div class="visible-xs-block label-text" id="label-cbox_783318X281X2231SQ001_SQ002"> Dealer to Client (D2C) </div> </td> <!-- end of answer_td_checkboxes --> <!-- right --> </tr> <!-- end of answer_row -->
How would I go and hide the second answer option?
Thank you very much!!!
The topic has been locked.
- bdeprez
- Offline
- Senior Member
Less
More
- Posts: 53
- Thank you received: 5
6 years 9 months ago #155073
by bdeprez
Replied by bdeprez on topic Disable specific boxes (=answer options) in a array question (numbers)
Never mind - I just tried out your code above and replaced it with the name of the checkbox and it did the trick!
Thanks again!
Thanks again!
The topic has been locked.
- mcovents
- Offline
- Senior Member
Less
More
- Posts: 43
- Thank you received: 0
5 years 2 weeks ago #181228
by mcovents
Replied by mcovents on topic Disable specific boxes (=answer options) in a array question (numbers)
I also want to hide a radio button for some subquestions in an array question but it doesn't seem to work.
It does work for checkboxes in an array(numbers) question but I need an array question with radio buttons.
I'm using Limesurvey version 3.15
This is the code that I'm trying to use:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('input[name="695528X43X1563SQ001_SQ001"]').attr('disabled', 'disabled');
$('input[name="695528X43X1563SQ002_SQ002"]').attr('hidden', 'hidden');
});
</script>
It does work for checkboxes in an array(numbers) question but I need an array question with radio buttons.
I'm using Limesurvey version 3.15
This is the code that I'm trying to use:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('input[name="695528X43X1563SQ001_SQ001"]').attr('disabled', 'disabled');
$('input[name="695528X43X1563SQ002_SQ002"]').attr('hidden', 'hidden');
});
</script>
The topic has been locked.