Quizmaker submit to email on finish

Chris Fletcher

156 posts

Posted Friday, April 15, 2011 at 8:17 AM  

Ok, so I've realised that if I move the command

 

EmailResults(arrArgs[6]); from case "CC_EmailResults": to case "CC_ClosePlayer":  in the Quiz.js file then when you click on finish, it will automatically email your results or (if like me you send it to an asp file) to your databse when the window closes.

 

This doesn't work in flashcommand.js however as the finish button doesnt call the ClosePlayer function. dioes anyone know if there is somewhere in that file that I can call the EmailResults function in order to get this to work when it moves on?

 

I'm guessing its not do-able, although I thought what I've done above wasn't either until I stumbled upon it by accident!!

 

Chris


This post has 0 verified answers

All Replies

User Rank Brian Batt

5,031 posts

Posted Friday, April 15, 2011 at 9:19 AM  

Hi Chris,

 

Is your quiz located inside of a presentation?  If so, you'll need to set your quiz to close the window when the Finish button is clicked:

 

http://www.articulate.com/support/presenter09/?p=19

 

Then, you'll need to take a look at these 2 functions in the flashcommand.js file:

 

case "ART_CloseAndExit":

 

case "CC_ClosePlayer";

 

That should get you pointed in the right direction.


Chris Fletcher

156 posts

Posted Monday, April 18, 2011 at 1:17 AM  

Thanks Brian,

 

If I do it as a standalone quiz, putting it into the CC_ClosePlayer case works fine, but it doesn't like it an actual presentation for some reason. I can get it to send them at any other stage along the way, just not when it moves out of the quiz!

 

Chris


Chris Fletcher

156 posts

Posted Monday, April 18, 2011 at 1:25 AM  

Got it. I was putting it in the wrong place.

 

I can now send my results straight through to a database using asp and by changing a bit of the code in the quiz.js/flashcommand.js file, without having to tick email results in the quiz setup which means that when you click on Finish at the end of the quiz, it automatically sends the results to an asp file which updates my database.

 

And not only that, as long as you can get the database bit sorted, it's pretty easy to do! Even easier if you just write to a text file and use excel (although probably not quite as robust)

 

Awesome!


Chris Fletcher

156 posts

Posted Monday, April 18, 2011 at 2:03 AM  

Nope, I take it back. It's not sending all the variables, so something's still wrong. Back to the drawingboard methinks!!


Erik Vinke

2 posts

Posted Tuesday, May 31, 2011 at 7:31 AM  

Chris Fletcher said:

Got it. I was putting it in the wrong place.

 

I can now send my results straight through to a database using asp and by changing a bit of the code in the quiz.js/flashcommand.js file, without having to tick email results in the quiz setup which means that when you click on Finish at the end of the quiz, it automatically sends the results to an asp file which updates my database.

 

And not only that, as long as you can get the database bit sorted, it's pretty easy to do! Even easier if you just write to a text file and use excel (although probably not quite as robust)

 

Awesome!


Hi there.

Care to share this solution with me / us?

 

I got it to work with php and using the e-mail button to call the script, but I am having a hard time figuring out how to automatically call the function, whit the solution mentioned above.

 

Also sharing the ASP would be really really great!

 

Hope to hear from you.

 

Erik

 

 

 

 

 

 

 

 

 

 

 

 


Chris Fletcher

156 posts

Posted Tuesday, June 14, 2011 at 12:40 AM  

Hi Erik, sorry I've not replied sooner, I've had a really busy couple of months.

 

After much trying, I eventually gave up on this. I couldn't get it to work at all. I think in memory I got it to work ok if you clicked on Print, but when I managed to get it to work as above, it cleared out quite a bit of the information I was trying to pass.

 

I may have another look in the coming weeks to see if I can find a workable solution, and if I do, I'll be sure to post my results up on here.


Chris


Erik Vinke

2 posts

Posted Tuesday, June 14, 2011 at 2:03 AM  

Hi Chris.

 

Thanks for you reply. Dont worry about it. The client I worked for opted for another solution.

 

Good luck.

 

Erik


Posted Friday, June 17, 2011 at 1:53 AM  

HI Guys,

 

I wonder if someone could tell me how to get the 'Close' button to email the Quiz results? I tried Articulate direct, but they just said it couldn't do it...I guess you guys know otherwise!

 

I noticed that Chris, you commented about moving some lines of code in the JS file...can you tell me exactly what I should move where?

 

My quiz.js code currently has the following, which I assume I have to edit somehow? Can you advise please?

 

-------------------------------------------------- HTML -------------------------------------------------------

        case "CC_EmailResults":
            g_oQuizResults.oOptions.bShowUserScore = (arrArgs[0] == "true");
            g_oQuizResults.oOptions.bShowPassingScore = (arrArgs[1] == "true");
            g_oQuizResults.oOptions.bShowShowPassFail = (arrArgs[2] == "true");
            g_oQuizResults.oOptions.bShowQuizReview = (arrArgs[3] == "true");
            g_oQuizResults.oOptions.strResult = arrArgs[4];
            g_oQuizResults.oOptions.strName = arrArgs[5];

            EmailResults(arrArgs[6]);
            break;
           
        case "QuizResults":
            g_oQuizResults.oOptions.bShowUserScore = (arrArgs[0] == "true");
            g_oQuizResults.oOptions.bShowPassingScore = (arrArgs[1] == "true");
            g_oQuizResults.oOptions.bShowShowPassFail = (arrArgs[2] == "true");
            g_oQuizResults.oOptions.bShowQuizReview = (arrArgs[3] == "true");
            g_oQuizResults.oOptions.strResult = arrArgs[4];
            g_oQuizResults.oOptions.strName = arrArgs[5];

            EmailResults(arrArgs[6]);
            break;
           
        case "CC_OpenUrl":
            OpenUrl(arrArgs[0], arrArgs[1], arrArgs[2], arrArgs[3], arrArgs[4], arrArgs[5], arrArgs[6], arrArgs[7],
                      arrArgs[8], arrArgs[9], arrArgs[10], arrArgs[11], arrArgs[12], arrArgs[13]);
            break;
           
        case "CC_OpenVideo":
            OpenVideo(arrArgs[0], arrArgs[1], arrArgs[2], arrArgs[3], arrArgs[4], arrArgs[5], arrArgs[6], arrArgs[7],
                      arrArgs[8], arrArgs[9], arrArgs[10], arrArgs[11], arrArgs[12], arrArgs[13]);
            break;
           
        case "CC_ClosePlayer":
            if (!g_bLMS)
            {
                if (FF)
                {
                    setTimeout("CloseWindow()", 100);
                }
                else
                {
                    CloseWindow();
                }
            }
            break;
           
        default:
            // alert(command);
            break;
    }

 

------------------------------------- HTML END ------------------------------------

 

Obviously there is more code than this, but I am assuming this is the section I need to look at having read your first post in this thread?

I'm a bit unsure as to exactly where to insert your suggested change?

Thank you in advance.

Dave.

 


Chris Fletcher

156 posts

Posted Monday, June 20, 2011 at 7:27 AM  

Hi Dave,

 

I spent quite a while looking into this, and in the end drew a blank. I could get it to submit, but it wasn't carrying any of the variables across so I was getting blank submissions. I've not had chance to look at it again recently so I dont know if there is a light at the end of the tunnel.

 

If I get chance, once my hectic work schedule calms down, I'll have a look at it again. If I ever get a solution, I will gladly post it on here.


C


Posted Monday, June 20, 2011 at 8:12 AM  

Thank for your response Chris.

In the end I bounced the Finish button to a 'Have you submitted your results?' page with a link back to the quiz just in case. Seems to work!

Thanks for your response.

 

Dave.


Gary Galmin

40 posts

Posted Monday, October 24, 2011 at 7:40 AM  

Is it possible to move the placement of the email results button over to the right?

 

I have renamed the Finish Button to Close and the Email Results button text to Final Submission. I am thinking if I can swap button places, this would make the success rate better for getting learners to see the button in a more natural finish position.

 


Chris Fletcher

156 posts

Posted Monday, October 24, 2011 at 8:17 AM  

Dont think you can move them, no, but there's a flash thing somewhere on here that allows you to cover up your finish button which is what I now use. You insert it into your pass slide, and it covers it up, then you just rename your email results button to finish, and have it redirect to your asp file, and that's all there is to it...

 

Let me have a quick look and see if I can find the flash file for you

 

Chris


Chris Fletcher

156 posts

Posted Monday, October 24, 2011 at 8:20 AM  

Here it is: http://daveperso.mediaenglishonline.com/2009/07/20/how-to-remove-the-finish-button-in-quizmaker-09/

 

It's not supported by Articulate, but it's just a flash file, so if you dont like it, or it doesn't do what you want, just delete it. Are you actually emailing the resutls, or have you got it writing to ASP/PHP?

 

Chris


Gary Galmin

40 posts

Posted Monday, October 24, 2011 at 8:25 AM  

Suggested Answer

Chris,

 

Our intentions are to email the results to a internal secure email address for a basic starting point for metrics.

 

Thanks for the link.

 

Gary


Chris Fletcher

156 posts

Posted Monday, October 24, 2011 at 8:35 AM  

Just for anyone elses's benefit, I've got a system that works really well for me now.

 

It goes a little something like this:

 

  1. Make sure question one in the quiz asks for the user's email address (a short answer survey question)
  2. Insert the removeFinish.swf flash file - http://daveperso.mediaenglishonline.com/2009/07/20/how-to-remove-the-finish-button-in-quizmaker-09/ into the "Pass" slide and ensure email results is ticked
  3. rename "Email Results" to Finish in the template
  4. Publish the training
  5. Open flashcommand.js file and replace the Email Results section completely with the following text:

function EmailResults(strAddress)
{
 if (!g_oQuizResults.strTitle)
 {
  g_oQuizResults.strTitle = "";
 }
 
 var g_strSubject = "Quiz Results: " + g_oQuizResults.strTitle;
 var strQuizResults = "";
 var strMainHeader = " " + g_oQuizResults.strTitle + "\nStatus, Raw Score, Passing Score, Max Score, Min Score, Time\n";
 var strLineHeader = "\n\nDate, Time, Score, Interaction ID, Objective Id, Interaction Type, Student Response, Result, Weight, Latency\n";
 var strMainData = "";
 var strLineData = "\n";
 var namer = g_arrResults[0].strStudentResponse
 
 strMainData += namer + ",";
 
 strMainData += g_oQuizResults.strTitle + ",";

 // Status
 // strMainData += g_oQuizResults.strResult + ",";
 
 // Score
 // strMainData += g_oQuizResults.strScore + ",";
 
 // Raw Score
 strMainData += g_oQuizResults.strPtScore + ",";
 
 // Passing Score
 // strMainData += Math.round((g_oQuizResults.strPassingScore/100) * g_oQuizResults.strPtMax) + ",";
 
 // Max Score
 // strMainData += g_oQuizResults.strPtMax + ",";
 
 // Min Score
 //strMainData += 0 + ",";
 
 // Time
 //strMainData += GetTime(g_oQuizResults.dtmFinished) + ",";
 
 strMainData += GetDate(g_arrResults[0].dtmFinished);
 
 for (var i = 0; i
 {
  //Date
  strLineData += GetDate(g_arrResults[i].dtmFinished) + ",";
  
  // Time
  strLineData += GetTime(g_arrResults[i].dtmFinished) + ",";
  
  // Score
  strLineData += g_arrResults[i].nPoints + ",";
  
  // Interaction Id
  strLineData += g_arrResults[i].strInteractionId + ",";
  
  // Objective Id
  strLineData += g_arrResults[i].strObjectiveId + ",";

  // Interaction Type
  strLineData += g_arrResults[i].strType + ",";

  // Student Response
  var strResponse = g_arrResults[i].strStudentResponse;
  strResponse = ReplaceAll(strResponse, "'", "%27");
  strLineData += strResponse + ",";
  
  // Result
  strLineData += g_arrResults[i].strResult + ",";
  
  // Weight
  strLineData += "1,";
  
  // Latency
  strLineData += g_arrResults[i].strLatency;
  
  strLineData += "\n";
 }
 
 strQuizResults = strMainData;

 var sHTML = "";
 sHTML += '';
 sHTML += '';
 sHTML += '';
 sHTML += '';
 sHTML += '

';
 sHTML += '';
 document.getElementById("divQuiz").innerHTML = sHTML;
 document.getElementById("formQuiz").submit();
}

 

This collects the person's email address, score, and the quiz name - which are all the results I need. It then posts them to my asp file (SubmitResults.asp) in the same window as the quiz (ie it doesn't open a new window, so there's no confusion as to whether it is finished or not).

6.     In that file, I have some asp which writes to my database. It looks a little bit like this:

 


Dim AdCn
Dim AdRec
Dim TimeRan
Dim i, SQL
Set AdCn = CreateObject("ADODB.Connection")
Set AdRec = CreateObject("ADODB.Recordset")


Dim conn

Set AdCn = Server.CreateObject("ADODB.Connection")
AdCn.Open "Provider=SQLOLEDB; Data Source = slk-tbw-sql1; Initial Catalog = *****;  User Id=*****;Password=*****;"
If AdCn.errors.count = 0 Then
SQL = "Insert into Results (EmailAddress, Course, Score) values('"& Request.Form("Quiz") & "', '"& Request.Form("Course")  & "', '"& Request.Form("Score")  & "')"
AdRec.Open SQL, AdCn,1,1

End If

AdCn.Close
Set AdCn = Nothing

%>

 

I then finish the asp off with a certificate that says Congratulations, you've passed "this" course on "this" date. "this" is your email address and "this" was your score. It wasn't easy to ensure that everyone put their names in correctly which is why I chose to take their email address. It's also a unique identifier which is something databases like!!

Of course you could do it to a text file instead if you dont have a database you can use, this works equally well, and the data can be manipulated quite nicely in Excel. You'd need to adapt the asp code to do this though to something maybe a bit like this:

Dim fso
Dim tst

Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set tst = fso.OpenTextFile(Server.MapPath("results.txt"), 8, true)
tst.writeline Request.ServerVariables("AUTH_USER")
tst.close
Set tst = Nothing
Set fso = Nothing
%>

 

Although this is a very old version that I used over a year ago, so it may not be quite as good as it could be.

Right, I've bored you enough now! If you find this interesting, but would like more info, then ask away. To be honest though, i've kinda fudged all this together with very little actual knowledeg of JavaScript or asp. I just kept changing things until they worked!!!


Chris


Rose T

8 posts

Posted Wednesday, March 07, 2012 at 12:04 PM  

Hi all,

 

I'm not able to open the zip file that the following link directs to. Any workarounds?

 

http://daveperso.mediaenglishonline.com/2009/07/20/how-to-remove-the-finish-button-in-quizmaker-09/

 

I would also look into the option directly above me, but I don't want to ask for an email address. 

 

Thanks,

Rose