Welcome, Guest
Username: Password: Remember me

TOPIC: Dual Scale Array to Multiple Scale Array Possibility?

Dual Scale Array to Multiple Scale Array Possibility? 3 years 10 months ago #78054

  • DianaS7
  • DianaS7's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
Hi Tony,

My name is Diana, I Want to do an array with 3 different scales. I saw your posts and I tried to reproduce it on my computer. But I can´t do it.
I created 3 different arrays with the same number of rows.I edited one of the question and clicked the "Source" button and then I copied the script that you posted e saved the page. But nothing happened.
I don´t know if I can just copy the script or if I have to do something else.

I hope you can help me.

On the image attached you can see what I need to do.

Thanks
Attachments:
The administrator has disabled public write access.

Dual Scale Array to Multiple Scale Array Possibility? 3 years 10 months ago #78057

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5421
  • Thank you received: 1156
  • Karma: 480
Hi Diana,

Did you disable the XSS filter?

Can you activate a sample survey for me to see?
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.

Dual Scale Array to Multiple Scale Array Possibility? 3 years 10 months ago #78103

  • DianaS7
  • DianaS7's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
Hi Tony,

Thanks for the response. I disable the XSS filter but it´s still not working. I´ve activated an example. As you can see in here:

dianas.limequery.com/index.php?sid=57517...oken=yscfhdxdyd7cy85

In the attachment, you can see what I want to do with the 3 tables that i've put on the survey.

Thanks for the help.

Diana
Attachments:
The administrator has disabled public write access.

Dual Scale Array to Multiple Scale Array Possibility? 3 years 10 months ago #78105

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5421
  • Thank you received: 1156
  • Karma: 480
I don't see the JavaScript in the sample survey. Did you add it?
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.

Dual Scale Array to Multiple Scale Array Possibility? 3 years 10 months ago #78118

  • DianaS7
  • DianaS7's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
I´m sorry,

Here it is:

dianas.limequery.com/index.php?sid=57517&newtest=Y&lang=en

As you can see i´ve putted the jaba code in the first question.

Thanks,

Diana
The administrator has disabled public write access.

Dual Scale Array to Multiple Scale Array Possibility? 3 years 10 months ago #78122

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5421
  • Thank you received: 1156
  • Karma: 480
It doesn't look like you disabled the XSS filter or didn't put the script in the source of the question (you should not be able to see the script when viewing the survey). Additionally, it doesn't look like you are using the latest version of the script.

1) Set up your survey to use JavaScript.

2) Add the following script to the source of the first array.
<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>
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.

Dual Scale Array to Multiple Scale Array Possibility? 3 years 10 months ago #78132

  • DianaS7
  • DianaS7's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
Thanks Tony for the help, but I don´t know why, but I can´t do it.

I disable the XSS filter. I went to Internet Options - Security - Custom Level of the Internet, and then I changed the XXS to disable.

After, I copied the new scrip that you gave me to the source of the Question 1 field. But like before, when I´m viewing the survey I can see the sript.

I think it may be something about the Jabascript, because, when I do the teste to see if JavaScript is enabled (Set up your survey to use JavaScript), the same happens, I can see the Test Script when I´m viewing the survey)

But, you did everything you could, thank you so much for the big help.

Diana
The administrator has disabled public write access.

Dual Scale Array to Multiple Scale Array Possibility? 3 years 10 months ago #78154

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5421
  • Thank you received: 1156
  • Karma: 480
No, the XSS filter in your LimeSurvey installation:

Global settings --> Security --> Filter HTML for XSS = "No"

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.

Dual Scale Array to Multiple Scale Array Possibility? 3 years 10 months ago #78173

  • DianaS7
  • DianaS7's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
Hi Tony.

Finally!!! It´s done!

The only (tyni) problem is that the 3 arrays are not aligned. As you can see:
dianas.limequery.com/index.php?sid=57517&newtest=Y&lang=en

There is something I can do?

Thank you. Your help has been precious :)

Diana
The administrator has disabled public write access.

Dual Scale Array to Multiple Scale Array Possibility? 3 years 10 months ago #78174

  • DianaS7
  • DianaS7's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
I´m sorry. I din´t activate the survey. You can see the array in the picture attached.

Thanks,

Diana
Attachments:
The administrator has disabled public write access.

Dual Scale Array to Multiple Scale Array Possibility? 3 years 10 months ago #78177

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5421
  • Thank you received: 1156
  • Karma: 480
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.

Dual Scale Array to Multiple Scale Array Possibility? 3 years 10 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.

Dual Scale Array to Multiple Scale Array Possibility? 3 years 10 months ago #78183

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5421
  • Thank you received: 1156
  • Karma: 480
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.

Dual Scale Array to Multiple Scale Array Possibility? 3 years 10 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.

Dual Scale Array to Multiple Scale Array Possibility? 3 years 10 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.
Moderators: ITEd
Time to create page: 0.277 seconds