Check out the LimeSurvey source code on GitHub!

variables, QID and javascript

More
3 years 10 months ago - 3 years 10 months ago #94123 by rodriguezm1
Not sure if this is the right part of the forum or not. Here it goes:


I have a series of questions. They are strings. Call them Question1, Question2, Question3, etc.

I want to write script to generate the QID and display stuff. Example:
<script type="text/javascript" charset="utf-8">
var i = 1; 
var theQID = "{Question" + i + ".answer}";
document.write(theQID);
</script>

I also tried
<script type="text/javascript" charset="utf-8">
var i = 1; 
var theQID = "{that.Question" + i + ".answer}";
document.write(theQID);
</script>

Both of these codes to not display anything. But this code DOES display something
<script type="text/javascript" charset="utf-8">
 
document.write({Question1});
 
</script>

Can someone help me to know what is going on with this? Is this possible to do? Or do you always have to input the QID literally, and not use text manipulation with variables? Thanks
Last Edit: 3 years 10 months ago by rodriguezm1.

Please Log in to join the conversation.

More
3 years 10 months ago #94136 by DenisChenu
Hello,

USe directly EM:
Question qid: {QID}
Question SGQ: {SGQ} (for example #answer{SGQ} giv you the id of the input short text).

Denis

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).

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form