- Posts: 74
- Thank you received: 26
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Hide next subquestion until current one is answered
- coeneisma
- Topic Author
- Offline
- Senior Member
Less
More
11 years 5 months ago #87712
by coeneisma
Hide next subquestion until current one is answered was created by coeneisma
Hi all,
Small question, searched but couldn't find the answer. Is it possible to hide the next subquestion untill any data is putt in the current one?
Got a question with 30 or so subquestions (multiple short questions, see attachment), and to keep the survey clean I want to hide all inputfields until the previous one is given.
Thanks in advance!
Small question, searched but couldn't find the answer. Is it possible to hide the next subquestion untill any data is putt in the current one?
Got a question with 30 or so subquestions (multiple short questions, see attachment), and to keep the survey clean I want to hide all inputfields until the previous one is given.
Thanks in advance!
Attachments:
The topic has been locked.
- coeneisma
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 74
- Thank you received: 26
11 years 5 months ago #87717
by coeneisma
Replied by coeneisma on topic Hide next subquestion until current one is answered
btw, language is set to dutch in attached lsg-file
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13643
- Thank you received: 2491
11 years 5 months ago #87727
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 Hide next subquestion until current one is answered
There are non included function in LimeSurvey.
You have to look at workarounds if you found something like this.
Maybe that one : docs.limesurvey.org/Workarounds%3A+Manip...exible_Text_question
You have to look at workarounds if you found something like this.
Maybe that one : docs.limesurvey.org/Workarounds%3A+Manip...exible_Text_question
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: 10109
- Thank you received: 3593
11 years 5 months ago #87758
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 Hide next subquestion until current one is answered
Or, as a simplified version of that workaround, you could add this to the source of the question. This script will hide all multiple-short-txt answers except the first one and then as a value is entered in each, the next one is shown.
Here's a sample survey with the code in the first question of your group.
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ $('.multiple-short-txt ul.subquestions-list li').hide(); $('.multiple-short-txt ul.subquestions-list li:first').show(); $('.multiple-short-txt ul.subquestions-list input.text').keyup(function(){ if($(this).val() !== '') { $(this).parents('li:eq(0)').next('li').show(); } }); }); </script>
Here's a sample survey with the code in the first question of your group.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The topic has been locked.
- coeneisma
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 74
- Thank you received: 26
11 years 5 months ago #87781
by coeneisma
Replied by coeneisma on topic Hide next subquestion until current one is answered
Thanks a lot guys! Cheers!
The topic has been locked.
- envitera
- Offline
- Junior Member
Less
More
- Posts: 20
- Thank you received: 0
9 years 5 months ago #113896
by envitera
How to change this code and the class .multiple-short-txt with .array-multi-flexi-text to adapt it for Array (Multi Flexible)(Text)? Thanks in advance for any possible hint given!
Replied by envitera on topic Hide next subquestion until current one is answered
tpartner wrote:
Code:<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ $('.multiple-short-txt ul.subquestions-list li').hide(); $('.multiple-short-txt ul.subquestions-list li:first').show(); $('.multiple-short-txt ul.subquestions-list input.text').keyup(function(){ if($(this).val() !== '') { $(this).parents('li:eq(0)').next('li').show(); } }); }); </script>
How to change this code and the class .multiple-short-txt with .array-multi-flexi-text to adapt it for Array (Multi Flexible)(Text)? Thanks in advance for any possible hint given!
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
9 years 5 months ago #113907
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 Hide next subquestion until current one is answered
This should do the trick:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ // Identify this question var thisQuestion = $('#question{QID}'); $('tr.subquestion-list', thisQuestion).hide(); $('tr.subquestion-list:first', thisQuestion).show(); $('input[type="text"]', thisQuestion).keyup(function(){ if($(this).val() !== '') { $(this).closest('tr.subquestion-list').next('tr.subquestion-list').show(); } }); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: envitera
The topic has been locked.
- envitera
- Offline
- Junior Member
Less
More
- Posts: 20
- Thank you received: 0
9 years 5 months ago - 9 years 5 months ago #114086
by envitera
Replied by envitera on topic Hide next subquestion until current one is answered
Yes, this works nice, thanks !
Oh and i've tried to integrate another condition in this script which would show only certain number of empty lines. This value would be defined in a preceding numeric question. Like described in this post . I'll try to make that functional and add the code later with a survey example.
Oh and i've tried to integrate another condition in this script which would show only certain number of empty lines. This value would be defined in a preceding numeric question. Like described in this post . I'll try to make that functional and add the code later with a survey example.
Last edit: 9 years 5 months ago by envitera. Reason: added text
The topic has been locked.