...

View Full Version : Creating a likert scale form, need help with processing data.



TheTrashcanMan
11-14-2012, 05:51 PM
Alright,

So I have built the likert form and a script to process a the score. Only problem is that I need help finishing it all and I need to have the score be displayed on the same as the form/likert form they just completed. Here is and example of the code I am using: (shorted for readability)


<div class="test">
<form action="" method="POST" id="form1">
1. Rate your level of visibility into information you need to proactively
and profitably run your business:</br>
<span class="answers">
<input type="radio" name="q1" value="1"/>
Zero visibility<br/>
<input type="radio" name="q1" value="2"/>
20 percent<br/>
<input type="radio" name="q1" value="3"/>
40 percent<br/>
<input type="radio" name="q1" value="4"/>
60 percent<br/>
<input type="radio" name="q1" value="5"/>
80 percent<br/>
<input type="radio" name="q1" value="6"/>
100 percent <br/>
</span>
<br/>

2. To stay on top of and improve your business, you (check all that apply):<br/>
<span class="answers">
<input type="radio" name="q2" value="1"/>
Check a daily dashboard that shows how you perform against key performance indicators<br/>
<input type="radio" name="q2" value="1"/>
Are automatically notified by your software system (via test or email) when certain conditions, such as a jobís profit threshold, arenít met<br/>
<input type="radio" name="q2" value="1"/>
Analyze your performance across projects and against industry benchmarks<br/>
<input type="radio" name="q2" value="1"/>
Spot trends and forecast costs and performance.<br/>
<input type="radio" name="q2" value="1"/>
Access key information while on the road using mobile devices <br/>
</span>
</form>

<input type='button' value='score' onclick="score()"/>

<script type="text/javascript">
function el(tid) {return document.getElementById(tid);}
function score(){
var ems = el("form1").elements;
var buff=[], count=0, total=0;
for(var i=0, mx=ems.length;i<mx;i++){
if(ems[i].checked){ total+=Number(ems[i].value); count++; }
}
alert("total: "+total+" ; Avg: "+ (total/count).toFixed(1) );
}
</script>
</div>


Any help would be greatly appreciated.

VIPStephan
11-14-2012, 06:13 PM
If you post any code please put it in between
tags. It makes scanning your posts much easier. You can do this by clicking the small ‘#’ icon above the reply field.

TheTrashcanMan
11-14-2012, 06:46 PM
If you post any code please put it in between
tags. It makes scanning your posts much easier. You can do this by clicking the small Ď#í icon above the reply field.

Sorry, didn't see that till after I had already clicked submit.


Also, I would like to add if anyone could also help me have the "alert" display the answer as a percentage. This percentage shows them how visible their business is.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum