Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: Array with many different fields in a row : My solution

Array with many different fields in a row : My solution 4 years 3 days ago #89755

  • tbudelli
  • tbudelli's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Thank you received: 1
  • Karma: 0
I am using 1.92+
Do I have to upgrade to be able to do thi? What are the risks for my existing surveys? Can I lose data if I upgrade? Would the upgrade impact the customized templates? Is 2.0 working ok with IIS?
Sorry for all these questions :) and Thank you very much for your help!
The administrator has disabled public write access.

Array with many different fields in a row : My solution 4 years 3 days ago #89766

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6574
  • Thank you received: 1477
  • Karma: 579
Denis is correct, the "subquestions-list" class only exists in 2.0 so try this code for 1.92:
<script type="text/javascript" charset="utf-8">
	$(document).ready(function(){
 
		// Identify the questions
		var thisQuestion = $('#question{QID}');
		var nextQuestion = $(thisQuestion).next('div[id^="question"]');
 
		// Hide the multi-text question
		$(nextQuestion).hide();
 
		// Add extra cells to the array rows
		$('table.question thead tr', thisQuestion).append('<th />');
		$('table.question tbody tr', thisQuestion).append('<td />');
 
		// Move the multi-text question text to the last column header cell of the array
		$('table.question thead tr th:last', thisQuestion).text($('.questiontext', nextQuestion).text());
 
		// Move the text inputs
		$('input.text', nextQuestion).each(function(i){
			$('table.question tbody tr:eq('+i+') td:last', thisQuestion).append(this);
		});
 
		// Some cleanup styles (for the default template)
		$('col', thisQuestion).css({
			'width': 'auto'
		});
		$('table.question tbody th, table.question tbody td', thisQuestion).css({
			'padding': '4px 10px'
		});
	});
</script>
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The administrator has disabled public write access.

Array with many different fields in a row : My solution 4 years 2 days ago #89799

  • tbudelli
  • tbudelli's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Thank you received: 1
  • Karma: 0
Thanks to both of you!
It is not working though.
Could IIS be the cause of the issue I am having with the code?
Is there any step I need to complete (beside Filter HTML for XSS set to NO) to activate Javascript and Jquery?

also I started to try the upgrade on my dev environment and I am stuck with the message:
Database upgrade

Please verify the following information before continuing with the database upgrade:

Database type: mysql
Database name: limesurvey
Table prefix: lime_
Site name: CMS Evaluation Tool
Root URL: /limesurvey/index.php/admin/update

When I try to access the Admin section. Any ideas?

Thank you,
Tony
The administrator has disabled public write access.

Array with many different fields in a row : My solution 4 years 2 days ago #89800

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6574
  • Thank you received: 1477
  • Karma: 579
I doubt it's an IIS problem.

Can you get any JavaScript to work?

Are there any errors in the console?

Try adding the following to the source of a question:
<script type="text/javascript" charset="utf-8">
	$(document).ready(function(){
 
		alert('JavaScript works!');
	});
</script>
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The administrator has disabled public write access.

Array with many different fields in a row : My solution 4 years 2 days ago #89801

  • tbudelli
  • tbudelli's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Thank you received: 1
  • Karma: 0
Yes! the Alert works fine.
The administrator has disabled public write access.

Array with many different fields in a row : My solution 4 years 2 days ago #89802

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6574
  • Thank you received: 1477
  • Karma: 579
Can you activate a test survey for me to see?
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The administrator has disabled public write access.

Array with many different fields in a row : My solution 4 years 2 days ago #89803

  • tbudelli
  • tbudelli's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Thank you received: 1
  • Karma: 0
unfortunately not!
Working behind firewalls w/o the ability to open ports...
The administrator has disabled public write access.

Array with many different fields in a row : My solution 4 years 2 days ago #89804

  • tbudelli
  • tbudelli's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Thank you received: 1
  • Karma: 0
nevermind, I will keep trying and let you know if I find the solution.
I really appreciate the time you spent and your ideas!
Thanks again,
Tony
The administrator has disabled public write access.

Array with many different fields in a row : My solution 4 years 2 days ago #89806

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6574
  • Thank you received: 1477
  • Karma: 579
Try this survey for 1.92. The script is in the source of q1.


File Attachment:

File Name: limesurvey...5195.lss
File Size:29 KB
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The administrator has disabled public write access.

Array with many different fields in a row : My solution 4 years 2 days ago #89809

  • tbudelli
  • tbudelli's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 14
  • Thank you received: 1
  • Karma: 0
It is not working for me unfortunately.
I have the array in one question
and the text in the second question. The script is not working for my configuration.
I really wonder what can make it fails...
The administrator has disabled public write access.

Array with many different fields in a row : My solution 4 years 2 days ago #89822

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6574
  • Thank you received: 1477
  • Karma: 579
Unfortunately, I can't help diagnosing much without seeing it live.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The administrator has disabled public write access.

Array with many different fields in a row : My solution 3 years 10 months ago #91102

  • Gabriela
  • Gabriela's Avatar
  • Offline
  • Senior Lime
  • Posts: 64
  • Thank you received: 1
  • Karma: 0
Hi all,

Please, how can I add a "matrix type" question in a column at the right of the multi text question in this layout? (so the final columns layout is: matrix-multiple text-matrix)
using this code its been created before in this topic?

<script type="text/javascript" charset="utf-8">
$(document).ready(function(){

// Identify the questions
var thisQuestion = $('#question{QID}');
var nextQuestion = $(thisQuestion).next('div[id^=question]');

// Hide the multi-text question
$(nextQuestion).hide();

// Add extra cells to the array rows
$('table.question thead tr', thisQuestion).append('<th />');
$('table.question tbody tr', thisQuestion).append('<td />');


// Move the multi-text question text to the last column header cell of the array
$('table.question thead tr th:last', thisQuestion).text($('.questiontext', nextQuestion).text());


// Move the text inputs
$('input.text', nextQuestion).each(function(i){
$('table.question tbody tr:eq('+i+') td:last', thisQuestion).append(this);
});

// Some cleanup styles (for the default template)
$('col', thisQuestion).css({
'width': 'auto'
});
$('table.question tbody th, table.question tbody td', thisQuestion).css({
'padding': '4px 10px'
});

});
</script>


Thanks in advance,
The administrator has disabled public write access.

Array with many different fields in a row : My solution 3 years 10 months ago #91111

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6574
  • Thank you received: 1477
  • Karma: 579
Hi Gabriela, I'm confused about what you mean by "matrix-multiple text-matrix". Can you give us a screenshot of a mock-up?
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The administrator has disabled public write access.

Array with many different fields in a row : My solution 3 years 10 months ago #91117

  • Gabriela
  • Gabriela's Avatar
  • Offline
  • Senior Lime
  • Posts: 64
  • Thank you received: 1
  • Karma: 0
yes.
Like this?

thanks!
Attachments:
The administrator has disabled public write access.

Array with many different fields in a row : My solution 3 years 10 months ago #91119

  • Gabriela
  • Gabriela's Avatar
  • Offline
  • Senior Lime
  • Posts: 64
  • Thank you received: 1
  • Karma: 0
sorry, not that image, but this one..
Attachments:
The administrator has disabled public write access.
Time to create page: 0.265 seconds
Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form