Use an answer to prefill another answer

Plus d'informations
il y a 7 ans 2 mois #83167 par amritdeep
In limesurvey workaround i have found the code for
"Use an answer to prefill another answer"

<script>
<!--
function Custom_On_Load(){
document.getElementById('answer1000X11X30').value='{INSERTANS:1000X10X20}';
document.getElementById('answer1000X11X31').value='{INSERTANS:1000X10X21}';
}
-->
</script>



Please tell me where i have to copy this code so that answer of '1000X10X20' copy to 'answer1000X11X30'

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

LimeSurvey Partners
Plus d'informations
il y a 7 ans 2 mois - il y a 7 ans 2 mois #83174 par TMSWhite
You can actually use Expression Manager to use one answer to set the value of another question, even if the other question is in another group (as is the case in your example).

Say your questions are 'a1' (1000X10X20), 'a2' (1000X10X21), 'b1' (1000X11X30), and 'b2' (1000X11X31), you would assign the values this way:
{b1=a1, b2=a2, ''}

This code could be put in a question or help text. Since it uses the comma operator, it returns the final value (''), so nothing will be displayed. You can also call this from either group 10 or group 11, although calling from group 11 will avoid having Expression Manager warn you of potential errors. Lastly, you don't need to put this within a <script>.

Some relevant documentation can be found here .
Dernière édition: il y a 7 ans 2 mois par TMSWhite.

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

Plus d'informations
il y a 3 jours 1 heure #188757 par gordonc123
Lets say I have 3 related limeSurvey questions where only one will have any content and the other two questions with no content (null) will be hidden...depending on which one matches the ID of a previous dropdown question.. So I wish to make a question further down the survey that will pull in the contents of the one of the 3 related questions that actually has content. How can I do this? Thanks, Gordon

Gordon Cantor

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

Plus d'informations
il y a 3 jours 1 heure #188758 par Joffm
You should explain a little bit more clearly.
What types of question are involved?
And of course send an example (*.lss) with the relevant questions.

I understand:
First there is a single punch question (drop-down) ("Q1")
Three further questions (what type?) ("Q2", "Q3", "Q4") have a relevance equation depending on Q1, so that only one of them is displayed.
I assume these are questions of type "short text".
Now you want to pipe the content of ("Q2", "Q3", "Q4") into a question ("Q5").

This is quite simple, because two of the question do not have a content, they are empty.
{join(Q2,Q3,Q4)} should do it, meaning all three contents are joined. Because two of them are empty, only the filled content will be piped.

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Les utilisateur(s) suivant ont remercié: gordonc123

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

Plus d'informations
il y a 2 jours 2 heures #188776 par gordonc123
Thank you very much Joffm! That got the value I wanted into question ("Q5") - my issue now is how to get that same value automatically into the ANSWER for "Q5" - so when I export the survey responses (Excel or csv), the question 5 column will contain that value for that survey record.

Gordon Cantor

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

Plus d'informations
il y a 1 jour 6 heures #188780 par Joffm
So use an question of type equation and pipe this question. You will get a column in the dataset, that contains the value.
Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless

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!