Welcome, Guest
Username: Password: Remember me

TOPIC: question and rankind in one row

question and rankind in one row 3 years 5 months ago #56301

  • arconet
  • arconet's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 4
  • Karma: 0
Is it possible to make a question containing a text field and ranking array in one row-
example: Which cars do you have, rank 1 to 5 balls

field1 1 2 3 4 5
field2 1 2 3 4 5
field3 1 2 3 4 5
The administrator has disabled public write access.

Re: question and rankind in one row 3 years 5 months ago #56302

  • arconet
  • arconet's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 4
  • Karma: 0
Sorry for the trouble, I almoust found it here, www.limesurvey.org/en/forum/design-issue...iy?limit=10&start=10 , but I'm not sure
how can I insert the javascript to the question source.
The administrator has disabled public write access.

Re: question and rankind in one row 3 years 5 months ago #56321

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
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: question and rankind in one row 3 years 5 months ago #56434

  • arconet
  • arconet's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 4
  • Karma: 0
It seems I'm still doing something wrong ..
I created a text question (id 3) and then an array quiesion (k31), after that inserted the javascript:

<script type="text/javascript" charset="utf-8">

$(document).ready(function() {

var qText = 3;
var qArray = K31;

// Fix the width of the survey
$( 'table.outerframe' ).css({'width': '900px'});

// Wrap the 2 questions ina container div and style it
$('#question'+qText+', #question'+qArray+'').wrapAll('<div class="inlineWrapper" />');
$('.inlineWrapper').append('<div style="clear:both" />');
$('.inlineWrapper').css({
'width': '75%',
'margin':'0 auto 10px auto',
'background-color':'#FFFFFF'
});
$('.inlineWrapper *').css({
'padding': '0',
'margin':'0'
});

// Hide the question and the help text
$('#question'+qText+' td.questiontext, #question'+qArray+' td.questiontext').parent().hide();
$('#question'+qText+' > table:eq(1), #question'+qArray+' > table:eq(1)').hide();
$('#question'+qText+' td.survey-question-help, #question'+qArray+' td.survey-question-help').parent().hide();

//Hide the answer cell of the array
$('#question'+qArray+' table.question thead tr').children(":first").hide();
$('#question'+qArray+' table.question tbody tr').children(":first").hide();
$('#question'+qArray+' col').attr('width', '');

// Push all question tables to 100%
$('#question'+qText+' table, #question'+qArray+' table').css({'width': '100%'});

// Get the 2 questions to sit politely side by side
$('#question'+qText+', #question'+qArray+'').css({'float':'left'});
$('#question'+qText+'').css({'padding':'15px 0 5px 25px'});
$('#question'+qText+'').css({'padding-top':'27px'}); // Adjust here for wrapped array labels
$('#question'+qArray+'').css({'padding':'5px 0 10px 0'});
$('#question'+qArray+' table.question td').css({'padding':'4px'});
$('#question'+qText+' table:first').attr('align', 'left');
$('#question'+qText+' label').css({
'display':'inline',
'width':'auto',
'margin-right':'10px'
});

// Set the widths of the 2 questions
$('#question'+qText+'').css({'width': '35%'});
$('#question'+qArray+'').css({'width': '58%'});

});

</script>

The problem is, at the preview I still only see my text questions:
www.arconet.ee/limesurvey/admin/admin.ph...ion&sid=89746&qid=97
The administrator has disabled public write access.

Re: question and rankind in one row 3 years 5 months ago #56437

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
Are you sure you used the correct IDs?


Untitled-2_2011-02-06.png
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: question and rankind in one row 3 years 5 months ago #56442

  • arconet
  • arconet's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 4
  • Karma: 0
Well, that was one of the problems :)
but it still doesnt do what I want to it to do..
Would you mind having a look at my site? I can make a donation to limesurvey or yourself for the effort..
The administrator has disabled public write access.

Re: question and rankind in one row 3 years 5 months ago #56448

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
That link is to a question preview and doesn't work without logging in.
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: question and rankind in one row 3 years 5 months ago #56517

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
Okay. I've had a look and tweaked your survey. I think you were using the wrong question types (and script) for your purposes.

I used an array-text question followed by a plain array question.

The array-text question has one column (x-scale subquestion) with no question text and 4 rows (y-scale subquestions). The array question has the same rows as the first question and uses a label-set 1-5.

Then I added the following code to the source of the first question (replace "11" with the array-text ID and "22" with the array ID).

The script wraps the 2 questions in a division, places them side-by-side and hides some unecessary elements.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
        // The question IDs
	var q1 = 11;       
        var q2 = 22;
 
        if ($('.inlineWrapper').length == 0) {
			// Fix the width of the survey
			$( 'table.outerframe' ).css({'width': '900px'});
 
			// Wrap the 2 questions ina container div and style it
			$('#question'+q1+', #question'+q2+'').wrapAll('<div class="inlineWrapper" />');
			$('.inlineWrapper').append('<div style="clear:both" />');
			$('.inlineWrapper').css({
				'width': '75%',
				'margin':'0 auto 10px auto',
				'background-color':'#FFFFFF'
			});
			$('.inlineWrapper *').css({
				'padding': '0',
				'margin':'0'
			});
 
			// Hide the question and the help text
			$('#question'+q1+' td.questiontext, #question'+q2+' td.questiontext').parent().hide();
			$('#question'+q1+' > table:eq(1), #question'+q2+' > table:eq(1)').hide();
			$('#question'+q1+' td.survey-question-help, #question'+q2+' td.survey-question-help').parent().hide();
 
			//Hide the answer cell of the array
			$('#question'+q2+' table.question thead tr').children(':first').hide();
			$('#question'+q2+' table.question tbody tr').children(':first').hide();
			$('#question'+q2+' table.question tbody tr').each(function(i) {
				$(this).children(':first').hide();
			});
			$('#question'+q2+' col').attr('width', '');
 
			// Push all question tables to 100%
			$('#question'+q1+' table, #question'+q2+' table').css({'width': '100%'});
 
			// Get the 2 questions to sit politely side by side
			$('#question'+q1+', #question'+q2+'').css({'float':'left'});
			$('#question'+q1+'').css({'padding':'5px 0 5px 25px'});
			$('#question'+q2+'').css({'padding':'5px 0 5px 0'});
			$('#question'+q1+' table.question tbody td, #question'+q2+' table.question tbody td').css({'height':'25px'});
 
			// Set the widths of the 2 questions
			$('#question'+q1+'').css({'width': '45%'});
			$('#question'+q2+'').css({'width': '48%'});
		}
 
    });
 
</script>


Untitled-1_2011-02-07.png
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.
Last Edit: 3 years 5 months ago by tpartner.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.135 seconds
Donation Image