Randomizing polls?

This forum is designated to discuss WinSurvey.
Post Reply
creigcooper
Newbie
Newbie
Posts: 1
Joined: November 13th, 2009, 12:27 am

Randomizing polls?

Post by creigcooper » November 13th, 2009, 11:27 pm

Ok, here's what I've done...

I created a database (MS SQL) that keeps the “Project ID” of each poll that I have created. I also created an asp page that pulls a project id at random and places it in the javascript code from WinSurvey. Here it is…

Code: Select all

<%@ LANGUAGE="VBScript" %>
<%
DSN = "DRIVER={SQL Server}; User ID=XX; Password=XX; Server=XX; Database=XX"
On Error Resume Next
Err.Clear
Dim conn
Set conn = server.CreateObject("ADODB.Connection")
conn.Open DSN
				
Set rsID = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT TOP 1 Poll_ID FROM PollQuestions ORDER BY NEWID()"
rsID.Open SQL, conn
%>
<script language="javascript" type="text/javascript" 
src="http://www.acebit-service.com/survey3/superlite/poll.php?ProjectID=<%= rsID("Poll_ID") %>"></script>
<noscript>Please activate JavaScript to display the poll correctly.</noscript><a href="http://www.winsurvey.com/" target=_blank><font size="-1">This poll is maintained by WinSurvey 3</font></a>
<%
rsID.Close : Set rsID = Nothing
conn.Close : Set conn = Nothing
%>
This works all well and good to randomize which poll question is displayed to the visitor; but (here comes the problem…) when the visitor submits their vote, it’s a crapshoot as to whether the results are displayed or another question. This seems to be because the page is refreshed to normally display the results, but in my case the asp randomizes the project id so sometimes I get the results and others I get another question. Okay so that got a little redundant, but you probably got the picture.

Now for the question… Is there a way to know if the user just submitted their vote and the results need to be displayed? That way I could by-pass the randomization pull from SQL.

Thanks!
CC

Post Reply