- Posts: 348
- Thank you received: 41
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Multiple short text: post-text for every subquestion
- Jmantysalo
- Topic Author
- Offline
- Platinum Member
Less
More
6 years 7 months ago #158068
by Jmantysalo
Multiple short text: post-text for every subquestion was created by Jmantysalo
Is it possible to make an array of text inputs like
I jump in a trampoline
1. about ___ times a day
2. about ___ times per week
3. about ___ times in a year
? I found manual.limesurvey.org/Workarounds:_Quest..._.22question_code.22 but there is not question.pstpl in newer version of LimeSurvey.
I jump in a trampoline
1. about ___ times a day
2. about ___ times per week
3. about ___ times in a year
? I found manual.limesurvey.org/Workarounds:_Quest..._.22question_code.22 but there is not question.pstpl in newer version of LimeSurvey.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
6 years 7 months ago - 6 years 7 months ago #158099
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 Multiple short text: post-text for every subquestion
The question.pstpl file does exist in the new versions of LimeSurvey and will through the LS 3.x series but I don't think you need to modify it for this layout.
1) Enter your prefixes and suffixes in the sub-question text, separated by commas as in the first screenshot below.
2) Set up your survey to use JavaScript and place the following script in the source of the question:
Sample survey attached:
1) Enter your prefixes and suffixes in the sub-question text, separated by commas as in the first screenshot below.
2) Set up your survey to use JavaScript and place the following script in the source of the question:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question var thisQuestion = $('#question{QID}'); // Insert the modified labels $('.control-label', thisQuestion).each(function(i) { var thisRow = $(this).closest('.answer-item'); var labels = $(this).text().split(',') $('input.text', thisRow).before('<span class="inserted-prefix">'+$.trim(labels[0])+'</span>'); $('input.text', thisRow).after('<span class="inserted-suffix">'+$.trim(labels[1])+'</span>'); }); // Some cleanup styling $('.control-label', thisQuestion).css({ 'display': 'none' }); $('.form-group.row > div', thisQuestion).css({ 'float': 'none', 'width': 'auto' }); $('input.text', thisQuestion).css({ 'display': 'inline-block', 'margin': '0 15px', 'width': '75px' }); }); </script>
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
Last edit: 6 years 7 months ago by tpartner.
The topic has been locked.
- Jmantysalo
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 348
- Thank you received: 41
6 years 7 months ago #158101
by Jmantysalo
Replied by Jmantysalo on topic Multiple short text: post-text for every subquestion
Great! This works, many thanks.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13642
- Thank you received: 2491
6 years 7 months ago #158123
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 Multiple short text: post-text for every subquestion
Needed option in future : we have a lot of user asking it.
And we already have the option for numeric input ( using | as separator).
And we already have the option for numeric input ( using | as separator).
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.
- surveySn
- Offline
- Premium Member
Less
More
- Posts: 136
- Thank you received: 4
4 years 2 months ago #193974
by surveySn
Replied by surveySn on topic Multiple short text: post-text for every subquestion
Hi Tpartner
It doesn't work,
3.21.1+191210
bootswatch and fruity
It doesn't work,
3.21.1+191210
bootswatch and fruity
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12921
- Thank you received: 3976
4 years 2 months ago #193976
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Multiple short text: post-text for every subquestion
Hi,
well, the script was for version 2.50/2.74.
It is therefore not surprising, that it doesn't work in version 3.x.
Especially since the syntax of input.text changed to input[type="text"]
So replace accordingly and it will work.
Joffm
well, the script was for version 2.50/2.74.
It is therefore not surprising, that it doesn't work in version 3.x.
Especially since the syntax of input.text changed to input[type="text"]
So replace accordingly and it will work.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
4 years 2 months ago #193977
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 Multiple short text: post-text for every subquestion
I was ignoring it until I got something like a polite request.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- surveySn
- Offline
- Premium Member
Less
More
- Posts: 136
- Thank you received: 4
4 years 2 months ago #193978
by surveySn
Replied by surveySn on topic Multiple short text: post-text for every subquestion
Hi tpartner, I'm sorry, I don't know what's impolite,
My mother tongue is not English. I translate it into English through translation software,
If my previous question is not polite, please forgive me, I'm sorry.
My mother tongue is not English. I translate it into English through translation software,
If my previous question is not polite, please forgive me, I'm sorry.
The topic has been locked.
- surveySn
- Offline
- Premium Member
Less
More
- Posts: 136
- Thank you received: 4
4 years 2 months ago #193981
by surveySn
Replied by surveySn on topic Multiple short text: post-text for every subquestion
Hi Joffm
Perfect, thank you,
Perfect, thank you,
The topic has been locked.