Welcome, Guest
Username: Password: Remember me

TOPIC: Dual Scale Array to Multiple Scale Array Possibility?

Re: Dual Scale Array to Multiple Scale Array Possibility? 2 years 5 months ago #78177

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4207
  • Thank you received: 791
  • Karma: 360
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Dual Scale Array to Multiple Scale Array Possibility? 2 years 5 months ago #78179

  • DianaS7
  • DianaS7's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
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>
The administrator has disabled public write access.

Re: Dual Scale Array to Multiple Scale Array Possibility? 2 years 5 months ago #78183

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4207
  • Thank you received: 791
  • Karma: 360
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.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Dual Scale Array to Multiple Scale Array Possibility? 2 years 5 months ago #78184

  • DianaS7
  • DianaS7's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
Yes, I changed everything to the same type and it´s perfect :)

Thank you

Diana
The administrator has disabled public write access.

Re: Dual Scale Array to Multiple Scale Array Possibility? 2 years 5 months ago #78194

  • DianaS7
  • DianaS7's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
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
Attachments:
The administrator has disabled public write access.

Re: Dual Scale Array to Multiple Scale Array Possibility? 2 years 5 months ago #78198

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4207
  • Thank you received: 791
  • Karma: 360
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Dual Scale Array to Multiple Scale Array Possibility? 2 years 5 months ago #78763

  • DianaS7
  • DianaS7's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
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 administrator has disabled public write access.

Re: Dual Scale Array to Multiple Scale Array Possibility? 1 year 2 months ago #98099

  • lsorg
  • lsorg's Avatar
tpartner wrote:
Ah, okay, use this:
<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: 1 year 2 months ago by lsorg.
The administrator has disabled public write access.

Re: Dual Scale Array to Multiple Scale Array Possibility? 1 year 2 months ago #98115

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6362
  • Thank you received: 827
  • Karma: 245
$('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
The administrator has disabled public write access.

Re: Dual Scale Array to Multiple Scale Array Possibility? 1 year 2 months ago #98129

  • lsorg
  • lsorg's Avatar
Great job. That's amazing, it works fantastic.

Thanks.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.136 seconds
Donation Image