Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: Dual Scale Array to Multiple Scale Array Possibility?

Re: Dual Scale Array to Multiple Scale Array Possibility? 2 Jahre 6 Monate her #78177

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4270
  • Dank erhalten: 803
  • Karma: 368
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.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Dual Scale Array to Multiple Scale Array Possibility? 2 Jahre 6 Monate her #78179

  • DianaS7
  • DianaS7s Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 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>
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Dual Scale Array to Multiple Scale Array Possibility? 2 Jahre 6 Monate her #78183

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4270
  • Dank erhalten: 803
  • Karma: 368
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.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Dual Scale Array to Multiple Scale Array Possibility? 2 Jahre 6 Monate her #78184

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

Thank you

Diana
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Dual Scale Array to Multiple Scale Array Possibility? 2 Jahre 6 Monate her #78194

  • DianaS7
  • DianaS7s Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 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
Anhang:
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Dual Scale Array to Multiple Scale Array Possibility? 2 Jahre 6 Monate her #78198

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4270
  • Dank erhalten: 803
  • Karma: 368
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.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Dual Scale Array to Multiple Scale Array Possibility? 2 Jahre 6 Monate her #78763

  • DianaS7
  • DianaS7s Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 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
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Dual Scale Array to Multiple Scale Array Possibility? 1 Jahr 3 Monate her #98099

  • lsorg
  • lsorgs Avatar
tpartner schrieb:
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
Letzte Änderung: 1 Jahr 3 Monate her von lsorg.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Dual Scale Array to Multiple Scale Array Possibility? 1 Jahr 3 Monate her #98115

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6429
  • Dank erhalten: 840
  • Karma: 249
$('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
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Dual Scale Array to Multiple Scale Array Possibility? 1 Jahr 3 Monate her #98129

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

Thanks.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.155 Sekunden
Donation Image