creating new variables from an existing array

More
1 year 1 month ago #141041 by n2xek
n2xek created the topic: creating new variables from an existing array
Hi,

I would like to access variables that I have created in the following script in other parts of the survey.
for example, I would like to be able to reference 'child1' in logic on other pages.

Here is the script I have working on the page.
Can you help me find a way to make this variables available throughout the questionnaire?

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

$(document).ready(function() {

var ar = [{lb1yr}, {lb2yr}, {lb3yr}, null];
var ar2 = ar.filter( function(v) {
if ( v != null ) {
return true;
}
});

var child1 = ar2[0];
var child2 = ar2[1];
var child3 = ar2[2];



} );

</script>

Please Log in to join the conversation.

More
1 year 1 month ago #141050 by DenisChenu
DenisChenu replied the topic: creating new variables from an existing array
If you need it in a survey : you need to fill an answer somewherer?

Something like this, with a multiple numeric question with Sub Q child1, child2 and child3
<script>
 $(document).ready(function() {
$("#question{QID}").hide();
// You srcipt for the vars
$("#answer{SGQ}child1").val(child1);
$("#answer{SGQ}child2").val(child2);
$("#answer{SGQ}child3").val(child3);
});
</script>

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 .

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now