Bienvenue, Invité
Nom d'utilisateur : Mot de passe : Se souvenir de moi

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

Re: Array with many different fields in a row : My solution il y a 1 an 9 mois #89822

  • tpartner
  • Portrait de tpartner
  • En ligne
  • LimeSurvey Team
  • Messages : 4195
  • Remerciements reçus 789
  • Karma: 359
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
L'administrateur a désactivé l'accès en écriture pour le public.

Re: Array with many different fields in a row : My solution il y a 1 an 8 mois #91102

  • Gabriela
  • Portrait de Gabriela
  • Hors ligne
  • Senior Lime
  • Messages : 64
  • 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,
L'administrateur a désactivé l'accès en écriture pour le public.

Re: Array with many different fields in a row : My solution il y a 1 an 8 mois #91111

  • tpartner
  • Portrait de tpartner
  • En ligne
  • LimeSurvey Team
  • Messages : 4195
  • Remerciements reçus 789
  • Karma: 359
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
L'administrateur a désactivé l'accès en écriture pour le public.

Re: Array with many different fields in a row : My solution il y a 1 an 8 mois #91117

  • Gabriela
  • Portrait de Gabriela
  • Hors ligne
  • Senior Lime
  • Messages : 64
  • Karma: 0
yes.
Like this?

thanks!
Pièces jointes :
L'administrateur a désactivé l'accès en écriture pour le public.

Re: Array with many different fields in a row : My solution il y a 1 an 8 mois #91119

  • Gabriela
  • Portrait de Gabriela
  • Hors ligne
  • Senior Lime
  • Messages : 64
  • Karma: 0
sorry, not that image, but this one..
Pièces jointes :
L'administrateur a désactivé l'accès en écriture pour le public.

Re: Array with many different fields in a row : My solution il y a 1 an 8 mois #91123

  • tpartner
  • Portrait de tpartner
  • En ligne
  • LimeSurvey Team
  • Messages : 4195
  • Remerciements reçus 789
  • Karma: 359
But...isn't that the same as this solution - www.limesurvey.org/en/forum/can-i-do-thi...it=10&start=10#90892 ?
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.
L'administrateur a désactivé l'accès en écriture pour le public.

Re: Array with many different fields in a row : My solution il y a 1 an 8 mois #91130

  • Gabriela
  • Portrait de Gabriela
  • Hors ligne
  • Senior Lime
  • Messages : 64
  • Karma: 0
:blink: :blink: :blink: :blink: ..(ect..)
sorry 2 much. thanks for reminding me.. (im with sort of with 10000 different surveys at the same time)..

And then , can I append this new mutiple-text column to the previous one (the one composed by the matrix + multiple text? )and build the figure from the image?
L'administrateur a désactivé l'accès en écriture pour le public.

Re: Array with many different fields in a row : My solution il y a 1 an 8 mois #91135

  • Gabriela
  • Portrait de Gabriela
  • Hors ligne
  • Senior Lime
  • Messages : 64
  • Karma: 0
Ok, now I understand..
Im having all this mess, cause its important to have graphic statistics on most questions as possible. So I was asked to avoid as much as possible input text questions. In this case, I wanted to build a layout where the first column is composed by an array (numbers), the second is a multiple input text (here had no option cause it can be any written answer) and the third column, a yes/no array (with no uncertain, thats way I chose a matrix (plain) type with yes/no as sub-answers, and dropbox setting)...
Im sending you the whole picture. Hope you can see it correctly cause its done in a custom template ect ect...

I need to append the "Disponível as crianças" question to the main layout. As a another column at the end (right)..

Grazie.
Pièces jointes :
L'administrateur a désactivé l'accès en écriture pour le public.

Re: Array with many different fields in a row : My solution il y a 1 an 8 mois #91151

  • tpartner
  • Portrait de tpartner
  • En ligne
  • LimeSurvey Team
  • Messages : 4195
  • Remerciements reçus 789
  • Karma: 359
And now I understand. I'll give this a little thought tonight.
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.
L'administrateur a désactivé l'accès en écriture pour le public.

Re: Array with many different fields in a row : My solution il y a 1 an 8 mois #91170

  • tpartner
  • Portrait de tpartner
  • En ligne
  • LimeSurvey Team
  • Messages : 4195
  • Remerciements reçus 789
  • Karma: 359
Here you go. This script will add columns to the first array question, hide the following questions and then insert their text inputs and select (dropdown) elements into the new columns.
<script type="text/javascript" charset="utf-8">$(document).ready(function(){
 
		// Identify the questions
		var thisQuestion = $('#question{QID}');
		var nextMultiText = $(thisQuestion).nextAll('.multiple-short-txt:eq(0)');
		var nextArrayFlexi = $(thisQuestion).nextAll('.array-flexible-row:eq(0)');
 
		// Hide the next questions 
		$(nextMultiText).hide();
		$(nextArrayFlexi).hide();
 
		// Add extra columns to the visible array
		$('table.question thead tr', thisQuestion).append('<th class="newColumn1" /><th class="newColumn2" />');
		$('table.question tbody tr', thisQuestion).append('<td class="newColumn1" /><td class="newColumn2" />');
 
		// Move the hidden question text to the inserted columns
		$('table.question thead tr th.newColumn1', thisQuestion).text($('.questiontext', nextMultiText).text());
		$('table.question thead tr th.newColumn2', thisQuestion).text($('.questiontext', nextArrayFlexi).text());
 
		// Move the hidden text inputs and dropdowns
		$('input.text', nextMultiText).each(function(i){
			$('table.question tbody tr:eq('+i+') td.newColumn1', thisQuestion).append(this);
		});
		$('select', nextArrayFlexi).each(function(i){
			$('table.question tbody tr:eq('+i+') td.newColumn2', 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>

Here's a demo survey:

Fichier attaché :

Nom du fichier : limesurvey_survey_234438.lss
Taille du ficher : 56 KB
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.
Dernière édition: il y a 1 an 8 mois par tpartner.
L'administrateur a désactivé l'accès en écriture pour le public.
Modérateurs: ITEd
Temps de génération de la page : 0.158 secondes
Donation Image