Check out the LimeSurvey source code on GitHub!

Is there some wrong?

More
4 years 11 months ago - 4 years 11 months ago #76191 by lewisrx
There is four type cars,I want to caculate how many people have speciel cars more than one,I design an Array (5 point choice) question so that people can select 1 or 2 or 3...for every tpye,but it did not work.
It is my first time to use javascript in limesurvey,and I have read the docs and searched in this forum,for my poor english,I still can not find the answer.Is there something wrong?
<script type="text/javascript" charset="utf-8"> 
$(document).ready(function(){
var mycars=new Array();
mycars[0]={INSERTANS:66175X7X133Q1};
mycars[1]={INSERTANS:66175X7X133Q2};
mycars[2]={INSERTANS:66175X7X133Q3};
mycars[3]={INSERTANS:66175X7X133Q4};
var num=0;
for (x in mycars)
{
   document.write(mycars[x]);
   if(mycars[x]>1)
   num=num+1;
}
document.write(num);
}
Last Edit: 4 years 11 months ago by lewisrx.

Please Log in to join the conversation.

More
4 years 11 months ago #76193 by TMSWhite
Using 1.92, you could do the following. Say your question is called q1, and you have four sub-questions A-D, you could add a Equation question type to compute the value you want.
{sum(q1_A>1, q1_B>1, q1_C>1, q1_D>1)}
The following user(s) said Thank You: lewisrx

Please Log in to join the conversation.

More
4 years 11 months ago #76196 by lewisrx
Thank you very much!!!

Please Log in to join the conversation.

More
4 years 11 months ago #76285 by Steve01
You're welcome :-)

If our hints have been helpful and you enjoy limesurvey please consider a donation to the team .
We do all this in our free time and you don't have to pay a penny for this software.

Without your help we can't keep this project alive.

Mit freundlichen Grüßen/Best regards,

Stefan Gohlke
LimeSurvey Team

Please Log in to join the conversation.

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