Prefill an array(Text) from a previous array(Text)

Plus d'informations
il y a 3 semaines 6 jours #176892 par krosser
krosser a créé le sujet : Prefill an array(Text) from a previous array(Text)
Hi guys,

I have to split a table and present it as two arrays with text inputs. Some answers/text inputs should be identical in both tables. So, I need to prefill certain text inputs in the 2nd array table, when the answers are typed in in the 1st table. I guess that is not possible with the subquestion validation or relevance equation, is it? I couldn't figure out the correct syntax. Would appreciate any help..

For example, "text 1" should appear in the 2nd array as "text 1" and so on...


A test survey attached..

Fichier attaché :

Nom du fichier : limesurvey...5243.lss
Taille du ficher :22 ko

I'm using the latest LS 3.15 hosted on LS servers, not installed locally.
Pièces jointes :

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 3 semaines 6 jours #176898 par krosser
krosser a répondu au sujet : Prefill an array(Text) from a previous array(Text)
Okay, guys. I've managed to do it with a JS code. For my particular example it is

<script type="text/javascript">
  $(document).ready(function () {
    $('#answer715243X12X689Y01_X01').on('change', function (e) {
       $('#answer715243X12X698Y01_X01').val($('#answer715243X12X689Y01_X01').val());
     	});
    $('#answer715243X12X689Y02_X01').on('change', function (e) {
       $('#answer715243X12X698Y02_X01').val($('#answer715243X12X689Y02_X01').val());
      	});
    $('#answer715243X12X689Y03_X01').on('change', function (e) {
       $('#answer715243X12X698Y03_X01').val($('#answer715243X12X689Y03_X01').val());
    	});
});
</script>


If someone thinks there is a better way, please let me know :)

I'm using the latest LS 3.15 hosted on LS servers, not installed locally.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 3 semaines 5 jours #176938 par DenisChenu
DenisChenu a répondu au sujet : Prefill an array(Text) from a previous array(Text)
The only solution to get it in same page.

You can use {SGQ} then if you copy the survey : don't need updatinf javascript

$(document).ready(function () {
    $('#answer{SGQ}Y01_X01').on('change', function (e) {
       $('#answer{that.Q2.SGQA}Y01_X01').val($(this).val());
     	});
    $('#answer{SGQ}Y02_X01').on('change', function (e) {
       $('#answer{that.Q2.SGQA}Y02_X01').val($(this).val());
      	});
    $('#answer{SGQ}Y03_X01').on('change', function (e) {
       $('#answer{that.Q2.SGQA}Y03_X01').val($(this).val());
    	});
});

Else : you don't really need the Q2 X1 value ? User must not update it ? Right ?

If right : maybe someting like this


Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Pièces jointes :

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 3 semaines 5 jours #176953 par krosser
krosser a répondu au sujet : Prefill an array(Text) from a previous array(Text)
Thanks man, but the script isn't working. I have tried to adjust Y and X there but still, nothing changes...

Regarding your second option, looks cool. I wouldn't be able to figure out the syntax myself. But I'd like to keep the numbers in the 1st subquestion column. It would be great if it was possible to do that for the answer choice column.

I'm using the latest LS 3.15 hosted on LS servers, not installed locally.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 3 semaines 5 jours #176967 par DenisChenu
DenisChenu a répondu au sujet : Prefill an array(Text) from a previous array(Text)
No, you need to put the answer on 1st columns … :/

Maybe some javascript solution …

About #answer{SGQ}Y01_X01' : it work if you put the script in question text (or use addScriptToQuestion ).

But you can't use it anywhare else (and maybe i make some error ;))

It use manual.limesurvey.org/Expression_Manager#Access_to_Variables , in question 698 in group 12 in surevy 715243 : {SGQ} must give 715243X12X698

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Connexion ou Créer un compte pour participer à la conversation.

Commencez dès maintenant !

Créez simplement un compte et commencez à utiliser LimeSurvey dès aujourd'hui.

Inscrivez-vous maintenant

Inscrivez-vous à notre Newsletter!