- Posts: 51
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Exclusive columns in one array + mixture of text and checkbox input?
- PaulMRFGR
- Topic Author
- Offline
- Senior Member
Less
More
4 years 11 months ago #183577
by PaulMRFGR
Exclusive columns in one array + mixture of text and checkbox input? was created by PaulMRFGR
Hi there,
Wondering if it's possible to do this question on Lime Survey. It's difficult to explain so I've taken a screenshot of the desired question (which has been created using a different survey system).
Is there anyway to replicate this on Limesurvey?
Obviously respondents should only be able to select one option each for the Gender and Employment Status sections of the array.
Thank you.
Wondering if it's possible to do this question on Lime Survey. It's difficult to explain so I've taken a screenshot of the desired question (which has been created using a different survey system).
Is there anyway to replicate this on Limesurvey?
Obviously respondents should only be able to select one option each for the Gender and Employment Status sections of the array.
Thank you.
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12779
- Thank you received: 3940
4 years 11 months ago #183578
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Exclusive columns in one array + mixture of text and checkbox input?
Example with drop-downs instead of radios.
It's smaller.
sample survey with more examples (Q1c is this one)
Joffm
It's smaller.
sample survey with more examples (Q1c is this one)
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- PaulMRFGR
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 51
- Thank you received: 0
4 years 11 months ago #183584
by PaulMRFGR
Replied by PaulMRFGR on topic Exclusive columns in one array + mixture of text and checkbox input?
Hey,
Thanks for this - it's really useful. Could you let me know what question type / settings you're using (only the import isn't working for some reason). Thanks!
Thanks for this - it's really useful. Could you let me know what question type / settings you're using (only the import isn't working for some reason). Thanks!
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12779
- Thank you received: 3940
4 years 11 months ago #183588
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Exclusive columns in one array + mixture of text and checkbox input?
Hi, the question type is array(text).
The javascript you find in the question code.
BUT:
Which LS version are you using?
The import isn't working?
No message, nothing? Just a white page?
Joffm
The javascript you find in the question code.
BUT:
Which LS version are you using?
The import isn't working?
No message, nothing? Just a white page?
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- PaulMRFGR
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 51
- Thank you received: 0
4 years 11 months ago #183590
by PaulMRFGR
Replied by PaulMRFGR on topic Exclusive columns in one array + mixture of text and checkbox input?
When I try to import, I'm getting the following error message:
Property "SurveyLanguageSetting.surveyls_policy_notice" is not defined.
An internal error occurred while the Web server was processing your request. Please contact the webmaster to report this problem.
Thank you.
Property "SurveyLanguageSetting.surveyls_policy_notice" is not defined.
An internal error occurred while the Web server was processing your request. Please contact the webmaster to report this problem.
Thank you.
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12779
- Thank you received: 3940
4 years 11 months ago #183594
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Exclusive columns in one array + mixture of text and checkbox input?
Though you still did not tell us your LS version, I am sure it is an old one.
Because in LS version 3.xx the data policy messages were included.
Therefore it is essential that the first information is the LS version.
There are some posts here how to import these *.lss files.
You just have to remove all lines in the file that contain something about the data policy.
I could try to adapt this to LS branch 2.50-2.73.
But not before I am sure you use this and not something like 1.92, 2.05, 2.06/2.6.
Joffm
Because in LS version 3.xx the data policy messages were included.
Therefore it is essential that the first information is the LS version.
There are some posts here how to import these *.lss files.
You just have to remove all lines in the file that contain something about the data policy.
I could try to adapt this to LS branch 2.50-2.73.
But not before I am sure you use this and not something like 1.92, 2.05, 2.06/2.6.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- PaulMRFGR
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 51
- Thank you received: 0
4 years 11 months ago #183595
by PaulMRFGR
Replied by PaulMRFGR on topic Exclusive columns in one array + mixture of text and checkbox input?
You're correct - just checked and we're version 2.05. Any way we could adapt the file? Thanks!
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12779
- Thank you received: 3940
4 years 11 months ago - 4 years 11 months ago #183598
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Exclusive columns in one array + mixture of text and checkbox input?
Well, the latest build of 2.05 was LimeSurvey 2.05+ build 141229 (nearly four and a half year ago)
You should really consider an update. Not only for security reasons.
In the meantime the template system changed twice. Many features were added, which the script relies on.
It's a simple question of type "array(text)".
Here is the code of the included javascript, which IMHO is easy to understand.
Maybe you are able to adapt. I am not.
Joffm
There is a plugin "arrayTextAdapt"
extensions.sondages.pro/questions-updati...ging/arraytextadapt/
The newest version is in the LimeStore.
The development started in 2016. So maybe there is a version for LS2.05
You should really consider an update. Not only for security reasons.
In the meantime the template system changed twice. Many features were added, which the script relies on.
It's a simple question of type "array(text)".
Here is the code of the included javascript, which IMHO is easy to understand.
Maybe you are able to adapt. I am not.
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ var thisQuestion = $('#question{QID}'); // Insert selects $('.answer-item.answer_cell_X003', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\ <option value="">Please choose...</option>\ <option value="1">male</option>\ <option value="2">female</option>\ <option value="3">other</option>\ <option value="4">DK/NA</option>\ </select>'); $('.answer-item.answer_cell_X004', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\ <option value="">Please choose...</option>\ <option value="1">Employed full time</option>\ <option value="2">Employed part time</option>\ <option value="3">3</option>\ <option value="4">4</option>\ <option value="5">5</option>\ </select>'); // Listeners $('.inserted-select', thisQuestion).on('change', function(i) { if($(this).val() != '') { $(this).closest('.answer-item').find('input:text').val($.trim($('option:selected', this).text())).trigger('change'); } else { $(this).closest('.answer-item').find('input:text').val('').trigger('change'); } }); // Returning to page $('.with-select input:text', thisQuestion).each(function(i) { var thisCell = $(this).closest('.answer-item'); var inputText = $.trim($(this).val()); var selectval = $('select.inserted-select option', thisCell).filter(function () { return $(this).html() == inputText; }).val(); $('select.inserted-select', thisCell).val(selectval); }); // Clean-up styles $('select.inserted-select', thisQuestion).css({ 'max-width': '100%' }); $('.with-select input:text', thisQuestion).css({ 'position': 'absolute', 'left': '-9999em' }); }); </script>
Joffm
There is a plugin "arrayTextAdapt"
extensions.sondages.pro/questions-updati...ging/arraytextadapt/
The newest version is in the LimeStore.
The development started in 2016. So maybe there is a version for LS2.05
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 4 years 11 months ago by Joffm.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
4 years 11 months ago #183612
by DenisChenu
But old one yes : gitlab.com/SondagesPro/QuestionSettingsType/arrayTextAdapt/tags
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 Exclusive columns in one array + mixture of text and checkbox input?
The last one : no.Joffm wrote: …
The development started in 2016. So maybe there is a version for LS2.05
But old one yes : gitlab.com/SondagesPro/QuestionSettingsType/arrayTextAdapt/tags
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: 10629
- Thank you received: 3696
4 years 11 months ago - 4 years 11 months ago #183617
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 Exclusive columns in one array + mixture of text and checkbox input?
This slightly modified script will work in 2.05:
Sample survey attached:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var thisQuestion = $('#question{QID}'); // Insert selects $('.answer-item.answer_cell_00X003', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\ <option value="">Please choose...</option>\ <option value="1">male</option>\ <option value="2">female</option>\ <option value="3">other</option>\ <option value="4">DK/NA</option>\ </select>'); $('.answer-item.answer_cell_00X004', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\ <option value="">Please choose...</option>\ <option value="1">Employed full time</option>\ <option value="2">Employed part time</option>\ <option value="3">3</option>\ <option value="4">4</option>\ <option value="5">5</option>\ </select>'); // Listeners $('.inserted-select', thisQuestion).on('change', function(i) { var thisTextInput = $(this).closest('.answer-item').find('input:text'); if($(this).val() != '') { $(thisTextInput).val($.trim($('option:selected', this).text())).trigger('keyup');; } else { $(thisTextInput).val('').trigger('keyup'); } }); // Returning to page $('.with-select input:text', thisQuestion).each(function(i) { var thisCell = $(this).closest('.answer-item'); var inputText = $.trim($(this).val()); var selectval = $('select.inserted-select option', thisCell).filter(function () { return $(this).html() == inputText; }).val(); $('select.inserted-select', thisCell).val(selectval); }); // Clean-up styles $('select.inserted-select', thisQuestion).css({ 'max-width': '100%' }); $('.with-select input:text', thisQuestion).css({ 'position': 'absolute', 'left': '-9999em' }); }); </script>
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 11 months ago by tpartner.
The topic has been locked.
- PaulMRFGR
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 51
- Thank you received: 0
4 years 11 months ago #183620
by PaulMRFGR
Replied by PaulMRFGR on topic Exclusive columns in one array + mixture of text and checkbox input?
Hi all,
Thanks for your help with this - all really useful stuff. We've managed to get this setup now (thanks particularly to Tony for providing the script for LS2.05)
Thank you.
Thanks for your help with this - all really useful stuff. We've managed to get this setup now (thanks particularly to Tony for providing the script for LS2.05)
Thank you.
The topic has been locked.