Stats based on a dropdown menu
Posted: 23 June 2008 02:59 PM   [ Ignore ]
Newbie
Rank
Total Posts:  4
Joined  2007-01-27

I have a form that includes a “How did you hear about us” dropdown menu, and I’d like to set up a template with a table displaying the count of each of the results.

The form field looks like this:

<label>How did you hear about us?</label>
<
select name="refer">
<
option  disabled="disabled">Choose One</option>
<
option value="Recommendation">Recommendation</option>
<
option value="Previous Customer">Previous Customer (same house)</option>
<
option value="TV Commercial">TV Commercial</option>
<
option value="Yellow Pages">Yellow Pages</option>
</
select></p>

I’d like the template to be something like this, where each number represents the number of times that individual option has been selected:

Recommendation: 10
Previous Customer: 4
TV Commercial: 12
Yellow Pages: 5

Is there a way to do this?

Profile
 
 
Posted: 24 June 2008 02:05 PM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3374
Joined  2006-10-18

artmem,

I don’t see an easy way to do this. It might be possible with some custom PHP and SQL coding though.

 Signature 
Profile
 
 
Posted: 24 June 2008 04:15 PM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  4
Joined  2007-01-27

I actually got it to work using a separate exp:freeform:count tag for each item, plus some php to make a bar graph.

<ul>
<
li>{exp:freeform:count form_name="free-consultation" refer="Recommendation"} Recommendation: {count} <div class="bar" style="width :<?=round(({count} / $total_entries) * 100);?>%; F">(<?=round(({count} / $total_entries) * 100);?>%)</div>{/exp:freeform:count}</li>
<
li>{exp:freeform:count form_name="free-consultation" refer="Previous Customer (same house)"} Previous Customer (same house): {count} <div style="float: right; width :<?=round(({count} / $total_entries) * 100);?>%; background-color: #00F">(<?=round(({count} / $total_entries) * 100);?>%)</div>{/exp:freeform:count}</li>
etc.
</
ul>

Profile
 
 
Posted: 25 June 2008 07:00 AM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3374
Joined  2006-10-18

Oh yeah, the Freeform Count function… silly me rasberry
Thanks for pointing that out....

 Signature 
Profile
 
 
   
 
 
‹‹ "From" Email      dropdown fields? ››