- Posts: 10115
- Thank you received: 3597
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Dual Scale Array to Multiple Scale Array Possibility?
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
12 years 4 weeks ago #78177
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 Dual Scale Array to Multiple Scale Array Possibility?
It looks like you have extra line breaks or empty paragraphs in the question texr for question 1. I would need to see the source (a live survey) to know which.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- DianaS7
- Offline
- New Member
Less
More
- Posts: 10
- Thank you received: 0
12 years 4 weeks ago #78179
by DianaS7
Replied by DianaS7 on topic Dual Scale Array to Multiple Scale Array Possibility?
I tried again and now the 1st and 2nd columns are aligned, but not the 2rd. As you can see:
dianas.limequery.com/index.php?sid=57517&newtest=Y&lang=en
This is the source of question 1:
Question 1 <script type="text/javascript" charset="utf-8">
$(document).ready(function() {
// Call the function wit the start and end question positions
sideBySide(1, 3);
function sideBySide(start, end) {
// Add some temporary classes to the target questions
$('div[id^="question"]').each(function(i){
var qNum = i + 1;
var el = $(this);
if (qNum >= start && qNum <= end) {
$(el).addClass('targetQ');
}
});
// Wrap the questions in a div
$('.targetQ').wrapAll('<div class="targetWrapper" />');
$('.targetWrapper').after('<div style="clear:both" />');
// Add some classes to the questions in the target wrapper
$('.targetWrapper .targetQ').addClass('inlineQuestion inlineQuestionSub');
$('.targetWrapper .inlineQuestionSub:first').removeClass('inlineQuestionSub').addClass('inlineQuestionPrime');
// Remove the text from the secondary questions
$('.targetWrapper .inlineQuestionSub th.answertext').text('');
// Apply some styles (these are for the default template)
$('.targetWrapper .inlineQuestion').css({ 'float': 'left' });
$('.targetWrapper .inlineQuestion col, .targetWrapper .inlineQuestion th.answertext').css({ 'width': 'auto' });
$('.targetWrapper .inlineQuestion .question-wrapper').css({ 'width': '100%' });
$('.targetWrapper .inlineQuestion td.answer').css({ 'padding': '0.5em 0' });
$('.targetWrapper .inlineQuestion td.questiontext').css({ 'text-align': 'center' });
// Center the wrapper div
var wrapperWidth = 0;
$('.targetWrapper .inlineQuestion').each(function(i){
wrapperWidth = wrapperWidth + $(this).width();
var padLeft = $('.answertext:eq(0)', this).width() + 3;
$('.questiontext', this).css({ 'padding-left':padLeft+'px', 'padding-right':'3px' });
});
$('.targetWrapper').css({ 'width':wrapperWidth+'px', 'margin': '0 auto' });
// Set the row heights
var wrapperWidth = 0;
$('.targetWrapper .inlineQuestionSub').each(function(i){
$('tbody[id^="javatbd"]', this).each(function(i){
var ansHeight = $('.targetWrapper .inlineQuestionPrime th.answertext:eq('+i+')').innerHeight();
if($.browser.mozilla) {
$('th.answertext', this).height(ansHeight-1);
}
else {
$('th.answertext', this).innerHeight(ansHeight);
}
});
});
// Remove the temporary classes
$('.targetQ').removeClass('targetQ');
$('.targetWrapper').removeClass('targetWrapper');
}
});
</script>
dianas.limequery.com/index.php?sid=57517&newtest=Y&lang=en
This is the source of question 1:
Question 1 <script type="text/javascript" charset="utf-8">
$(document).ready(function() {
// Call the function wit the start and end question positions
sideBySide(1, 3);
function sideBySide(start, end) {
// Add some temporary classes to the target questions
$('div[id^="question"]').each(function(i){
var qNum = i + 1;
var el = $(this);
if (qNum >= start && qNum <= end) {
$(el).addClass('targetQ');
}
});
// Wrap the questions in a div
$('.targetQ').wrapAll('<div class="targetWrapper" />');
$('.targetWrapper').after('<div style="clear:both" />');
// Add some classes to the questions in the target wrapper
$('.targetWrapper .targetQ').addClass('inlineQuestion inlineQuestionSub');
$('.targetWrapper .inlineQuestionSub:first').removeClass('inlineQuestionSub').addClass('inlineQuestionPrime');
// Remove the text from the secondary questions
$('.targetWrapper .inlineQuestionSub th.answertext').text('');
// Apply some styles (these are for the default template)
$('.targetWrapper .inlineQuestion').css({ 'float': 'left' });
$('.targetWrapper .inlineQuestion col, .targetWrapper .inlineQuestion th.answertext').css({ 'width': 'auto' });
$('.targetWrapper .inlineQuestion .question-wrapper').css({ 'width': '100%' });
$('.targetWrapper .inlineQuestion td.answer').css({ 'padding': '0.5em 0' });
$('.targetWrapper .inlineQuestion td.questiontext').css({ 'text-align': 'center' });
// Center the wrapper div
var wrapperWidth = 0;
$('.targetWrapper .inlineQuestion').each(function(i){
wrapperWidth = wrapperWidth + $(this).width();
var padLeft = $('.answertext:eq(0)', this).width() + 3;
$('.questiontext', this).css({ 'padding-left':padLeft+'px', 'padding-right':'3px' });
});
$('.targetWrapper').css({ 'width':wrapperWidth+'px', 'margin': '0 auto' });
// Set the row heights
var wrapperWidth = 0;
$('.targetWrapper .inlineQuestionSub').each(function(i){
$('tbody[id^="javatbd"]', this).each(function(i){
var ansHeight = $('.targetWrapper .inlineQuestionPrime th.answertext:eq('+i+')').innerHeight();
if($.browser.mozilla) {
$('th.answertext', this).height(ansHeight-1);
}
else {
$('th.answertext', this).innerHeight(ansHeight);
}
});
});
// Remove the temporary classes
$('.targetQ').removeClass('targetQ');
$('.targetWrapper').removeClass('targetWrapper');
}
});
</script>
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10115
- Thank you received: 3597
12 years 4 weeks ago #78183
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 Dual Scale Array to Multiple Scale Array Possibility?
This workaround is limited to questions of the same type.
If you use different question types you will need to add some custom CSS to control the row heights.
If you use different question types you will need to add some custom CSS to control the row heights.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- DianaS7
- Offline
- New Member
Less
More
- Posts: 10
- Thank you received: 0
12 years 4 weeks ago #78184
by DianaS7
Replied by DianaS7 on topic Dual Scale Array to Multiple Scale Array Possibility?
Yes, I changed everything to the same type and it´s perfect
Thank you
Diana
Thank you
Diana
The topic has been locked.
- DianaS7
- Offline
- New Member
Less
More
- Posts: 10
- Thank you received: 0
12 years 4 weeks ago #78194
by DianaS7
Replied by DianaS7 on topic Dual Scale Array to Multiple Scale Array Possibility?
I just have one more question.
Do you if it´s possible to add another option to a text/numeric type question. See in the image attached, please.
Thnaks,
Diana
Do you if it´s possible to add another option to a text/numeric type question. See in the image attached, please.
Thnaks,
Diana
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10115
- Thank you received: 3597
12 years 4 weeks ago #78198
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 Dual Scale Array to Multiple Scale Array Possibility?
That doesn't seem related to this discussion. Please start new threads for new topics.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- DianaS7
- Offline
- New Member
Less
More
- Posts: 10
- Thank you received: 0
12 years 2 weeks ago #78763
by DianaS7
Replied by DianaS7 on topic Dual Scale Array to Multiple Scale Array Possibility?
Hi Tony,
The multiple scale array is working perfectly in Google Chrome and Internet Explorer, but it doesn´t work in Mozilla.
There´s anything I can do?
Thanks,
Diana
The multiple scale array is working perfectly in Google Chrome and Internet Explorer, but it doesn´t work in Mozilla.
There´s anything I can do?
Thanks,
Diana
The topic has been locked.
- lsorg
- Visitor
10 years 9 months ago - 10 years 9 months ago #98099
by lsorg
Hey guys,
I'm using limesurvey since a few days and it is fantastic.
Now I had the same issue like the thread starter. I copy the script and it worked to build the questions side by side.
But my problem is that it builds all question in the chapter side by side. But I only want the first and the second question side by side.
Does anyone know how I can change the script code that it only puts the questions side by side that I want? I think it would work with the question id, but I don't know how.
Best regards,
lsorg
Replied by lsorg on topic Dual Scale Array to Multiple Scale Array Possibility?
tpartner wrote: Ah, okay, use this:
Code:<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Loop through all questions (except boilerplates) and add some classes $('div[id^="question"]').each(function(i){ if (!$(this).hasClass('boilerplate')) { $(this).addClass('inlineQuestion inlineQuestionSub'); } }); $('.inlineQuestionSub:first').removeClass('inlineQuestionSub').addClass('inlineQuestionPrime'); // Wrap the questions in a div $('.inlineQuestion').wrapAll('<div class="inlineWrapper" />'); // Remove the text from the secondary questions $('.inlineQuestionSub th.answertext').text(''); // Apply some styles (these are for the default template) $('.inlineQuestion').css({ 'float': 'left' }); $('.inlineQuestion col, .inlineQuestion th.answertext').css({ 'width': 'auto' }); $('.inlineQuestion .question-wrapper').css({ 'width': '100%' }); $('.inlineQuestion td.answer').css({ 'padding': '0.5em 0' }); $('.inlineQuestion td.questiontext').css({ 'text-align': 'center' }); // Center the wrapper div var wrapperWidth = 0; $('.inlineQuestion').each(function(i){ wrapperWidth = wrapperWidth + $(this).width(); var padLeft = $('.answertext:eq(0)', this).width() + 3; $('.questiontext', this).css({ 'padding-left':padLeft+'px', 'padding-right':'3px' }); }); $('.inlineWrapper').css({ 'width':wrapperWidth+'px', 'margin': '0 auto' }); // Set the row heights var wrapperWidth = 0; $('.inlineQuestionSub').each(function(i){ $('tbody[id^="javatbd"]', this).each(function(i){ var ansHeight = $('.inlineQuestionPrime th.answertext:eq('+i+')').innerHeight(); //$('th.answertext', this).css({ 'height':ansHeight+'px' }); if($.browser.mozilla) { $('th.answertext', this).height(ansHeight); } else { $('th.answertext', this).innerHeight(ansHeight); } }); }); }); </script>
Hey guys,
I'm using limesurvey since a few days and it is fantastic.
Now I had the same issue like the thread starter. I copy the script and it worked to build the questions side by side.
But my problem is that it builds all question in the chapter side by side. But I only want the first and the second question side by side.
Does anyone know how I can change the script code that it only puts the questions side by side that I want? I think it would work with the question id, but I don't know how.
Best regards,
lsorg
Last edit: 10 years 9 months ago by lsorg.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13676
- Thank you received: 2496
10 years 9 months ago #98115
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 Dual Scale Array to Multiple Scale Array Possibility?
$('div[id^="question"]').each(function(i){
to
$('#question42,#question43').each(function(i){
If your question number are 42 and 43.
Please read jquery documentation : api.jquery.com/category/selectors/
Denis
to
$('#question42,#question43').each(function(i){
If your question number are 42 and 43.
Please read jquery documentation : api.jquery.com/category/selectors/
Denis
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.
- lsorg
- Visitor
10 years 9 months ago #98129
by lsorg
Replied by lsorg on topic Dual Scale Array to Multiple Scale Array Possibility?
Great job. That's amazing, it works fantastic.
Thanks.
Thanks.
The topic has been locked.
- dagustin
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
8 years 1 month ago #132899
by dagustin
Replied by dagustin on topic Dual Scale Array to Multiple Scale Array Possibility?
Hi everyone!
I have the same problem as Newbeedu. The main difference is that I must use selectboxes because the answers list is very long. I tried with Tpartner's script but it doesnt work. Could someone help me?
Thank you and have a nice day!
I have the same problem as Newbeedu. The main difference is that I must use selectboxes because the answers list is very long. I tried with Tpartner's script but it doesnt work. Could someone help me?
Thank you and have a nice day!
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10115
- Thank you received: 3597
8 years 1 month ago #132902
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 Dual Scale Array to Multiple Scale Array Possibility?
dagustin, this topic and the workarounds are very old and may not be suitable for recent versions. Please start a new thread explaining exactly what you are trying to do and include screenshots, your LimeSurvey version number and a small sample survey.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.