- Beiträge: 26
- Dank erhalten: 0
- Community
- Forum
- Englische Foren
- Can I do this with LimeSurvey?
- Exclusive columns in one array + mixture of text and checkbox input?
Exclusive columns in one array + mixture of text and checkbox input?
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.
Anhänge:
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
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
Anhänge:
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
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!
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
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
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
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.
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
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
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
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.
<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"
https://extensions.sondages.pro/questions-updating-and-managing/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
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- DenisChenu
-
- Offline
- LimeSurvey Community Team
-
- Beiträge: 12025
- Karma: 413
- Dank erhalten: 2195
The last one : no.Joffm schrieb: …
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 .
An error happen ? Before make a new topic : remind the Debug mode .
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- Beiträge: 8562
- Karma: 621
- Dank erhalten: 2631
<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.
Official LimeSurvey Partner - partnersurveys.com
Anhänge:
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
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.
Bitte Anmelden oder Registrieren um der Konversation beizutreten.