Submit Assignment From Flash

Topics: Developer Forum, User Forum
Jul 8, 2008 at 7:28 PM
Hi all.

All our courses are Flash Based, and we are developing in SCORM 2004 3rd Edition for several LMS, and one of the problems we have with Sharepoint is the fact that we have to click on the submit assignment button. Even if i comit to the LMS the completion_status = completed, the success_status = passed, and the scores.... raw, scaled what ever, he doesnt do nothing until i press that damm submit button :P.

Is there a way for me to Submit the assignment from within Flash, caling an external function on the sharepoint api or something?

Thanx in advance.
Jul 8, 2008 at 10:53 PM
Probably the easiest way to do this would be for the Flash control to reach out into the HTML dom and activate the Submit button.

I have not looked at this, but would take this route first before attempting any fudged API calls as the experience will remain faily consistent.

Andrew
Jul 23, 2008 at 6:36 PM
Hello Gandalf & Andrew & Co...

I too have issues with the 'Submit Assignment' buttons.  After completing the flash quiz (created with Quizmaker), we can get the score sent to SLK, but then the user must click either the 'submit assignment' button that shows in the TOC on the left OR the 'submit' button where the learner can either begin/resume assignment or submit).  Of course, both options include the obligatory 'are you sure you really want to submit this assignment' question. This adds an unnecessary layer of confusion, as the learner has already 'submitted' the quiz in the flash module.

A possible solution would be to fake a submit call from the final 'goodbye.html' page that Quizmaker uses to give further instructions after completing a quiz... but really what would be ideal is to 1) remove the duplicate 'submit assignment' menu item in the module TOC and 2) call this submit action direct from flash/javascript.

Over all I find the SLK to be very useful for delivering training in a corporate environment that has already standardized on SharePoint... but there needs to clearer ways to customize the learner experience.  I suppose there is a way to do this by modifying the SLK templates, but this is not a realistic option in a corporate environment.  Has anyone had success deploying an intuitive work flow using SLK that even a grandma can understand?  Something graceful like: 1) start the quiz....2) answer the questions 3)submit the quiz ONCE....done.

-Baden
Jul 31, 2008 at 12:06 PM
Edited Jul 31, 2008 at 12:07 PM
After much trial and error, I have discovered at least a way to automatically hit the 'submit assignment' button via javascript.
From the content window the following needs to be called:

     top.frames[1].frames[1].document.getElementById('aSUBMIT').click();

This will automatically bring the student to the 'are you sure you want to submit this assignment' screen.  In digging through the code, it seams there is a complete set of FrameManager functions that could be called form the content frame... but I have so far been unsucessfull in triggering the acutal 'doSubmit' function with code.

Hope this helps bring you one step closer to the goal.

-Baden
Coordinator
Aug 25, 2008 at 7:02 PM
FYI, I added a web service to SLK to enable just this -- it's called the Tracking Service.  It's based on the IEEE XML schema for CMI Tracking information.  Some pointers for getting started here are:

http://www.codeplex.com/SLK/Wiki/View.aspx?title=Enabling%20CMI%20Tracking%20for%20non-eLearning%20content&referringTitle=New%20Feature%20Documentation

http://www.codeplex.com/SLK/SourceControl/FileView.aspx?itemId=414959&changeSetId=33333
http://www.codeplex.com/SLK/SourceControl/FileView.aspx?itemId=414951&changeSetId=33333

Take a look at this and let me know how it looks for you.  I wanted to write some simple content that would demonstrate its use and have unfortunately not gotten around to it yet, but this approach should work well from Flash.
Mar 18, 2009 at 4:13 AM
Hacking learning management systems is a hobby of mine, and I hate the fact that my learners have to click a submit button for a single SCO aggregation. Also, since it is a single SCO aggregation, there is no need for the navigation pane at all, and the title is redundant - I already have one in my course. I decided to have the course do away with the whole SLK framework UI. I do this when I launch the course:


top.document.getElementById('framesetOuter').rows = '0,*'; // This removes the title frame on the top. You can omit this if you want to keep the title.

var framesets = top.document.getElementById(top.MAIN_FRAME).contentWindow.document.getElementsByTagName('FRAMESET');

for (var f = 0; f < framesets.length; f++){

            if(framesets[f].rows != ''){

                  framesets[f].rows = framesets[f].rows.replace(/\d+/g, 0);

                  framesets[f].rows = framesets[f].rows.replace(/[\%]/g, '');

            }

            if(framesets[f].cols != ''){

                  framesets[f].cols = framesets[f].cols.replace(/\d+/g, 0);

                  framesets[f].cols = framesets[f].cols.replace(/[\%]/g, '');

            }

}

Then when the student takes the assessment at the end of my course and the course sends the SCORM calls for the score and status, this code silently submits the course without unloading the course:

top.TempIsTrainingComplete = top.API_GetFramesetManager().IsTrainingComplete;

top.TempShowErrorMessage = top.API_GetFramesetManager().ShowErrorMessage;

top.API_GetFramesetManager().IsTrainingComplete = function(){return false;};

top.API_GetFramesetManager().ShowErrorMessage = function(){top.API_GetFramesetManager().ShowErrorMessage = top.TempShowErrorMessage;top.API_GetFramesetManager().IsTrainingComplete = top.TempIsTrainingComplete;};

top.API_GetFramesetManager().DoSubmit();


That way the student can contunue to use the course and interact with it, but when they close the widow, the final score has been submitted without any further action.


 

Mar 18, 2009 at 1:01 PM
Hi all,

We handled this issue by adding the submit button to the last page in flash. The button simply calls javascript:top.g_frameMgr.DoSubmit(); and then closes the window.

I'll have to take look at the web service Jay mentioned...

Br,
Marko Kurjonen
Jun 8, 2009 at 10:23 AM

Hi

I am getting the javascript error on the framset. Java.lang.exception:java.lang.null.pointerexception.

can you please provide me the solution. My course is not getting loaded.

 

Regrds,

amit.

Coordinator
Jun 10, 2009 at 8:39 PM

Hi Amit,

That looks like a Java error not a Javascript one. It must be an error within the content rather than the SLK.

Richard

SLK Co-ordinator

http://blog.salamandersoft.co.uk

Dec 30, 2009 at 10:44 PM
Edited Dec 31, 2009 at 2:48 PM

Sorry, entered twice.

Dec 30, 2009 at 10:44 PM
dcarlile wrote:
Hacking learning management systems is a hobby of mine, and I hate the fact that my learners have to click a submit button for a single SCO aggregation. Also, since it is a single SCO aggregation, there is no need for the navigation pane at all, and the title is redundant - I already have one in my course. I decided to have the course do away with the whole SLK framework UI. I do this when I launch the course:


top.document.getElementById('framesetOuter').rows = '0,*'; // This removes the title frame on the top. You can omit this if you want to keep the title.

var framesets = top.document.getElementById(top.MAIN_FRAME).contentWindow.document.getElementsByTagName('FRAMESET');

for (var f = 0; f < framesets.length; f++){

            if(framesets[f].rows != ''){

                  framesets[f].rows = framesets[f].rows.replace(/\d+/g, 0);

                  framesets[f].rows = framesets[f].rows.replace(/[\%]/g, '');

            }

            if(framesets[f].cols != ''){

                  framesets[f].cols = framesets[f].cols.replace(/\d+/g, 0);

                  framesets[f].cols = framesets[f].cols.replace(/[\%]/g, '');

            }

}

Then when the student takes the assessment at the end of my course and the course sends the SCORM calls for the score and status, this code silently submits the course without unloading the course:

top.TempIsTrainingComplete = top.API_GetFramesetManager().IsTrainingComplete;

top.TempShowErrorMessage = top.API_GetFramesetManager().ShowErrorMessage;

top.API_GetFramesetManager().IsTrainingComplete = function(){return false;};

top.API_GetFramesetManager().ShowErrorMessage = function(){top.API_GetFramesetManager().ShowErrorMessage = top.TempShowErrorMessage;top.API_GetFramesetManager().IsTrainingComplete = top.TempIsTrainingComplete;};

top.API_GetFramesetManager().DoSubmit();


That way the student can contunue to use the course and interact with it, but when they close the widow, the final score has been submitted without any further action.


 

 We have this exact issue where the CBTs were designed for full screen and now it seems confusing for learners to have all these windows opening.   Your work around sounds interesting.  Can you tell me exactly were you added your code to keep the frameset from launching and the silent submit?  Not exactly clear from your post.  Thanks!

Dec 30, 2009 at 11:24 PM
Edited Jan 4, 2010 at 7:26 PM

The top snippet of code should be run when your course launches. The easiest way is to enclose it in script tags in the html document that the LMS first launches, but you can run the code any time. The second snippet should be run when your student  has completed the course. Put it in a function and call the function when your student has completed the course. It depends on your course. If you have an assessment and they have completed it, that would be a good time, or if your student has viewed every page, you could do it then too. It depends on what constitutes a completed course.

 

Does that answer your question?

 

From: jriesen

dcarlile wrote:
Hacking learning management systems is a hobby of mine, and I hate the fact that my learners have to click a submit button for a single SCO aggregation. Also, since it is a single SCO aggregation, there is no need for the navigation pane at all, and the title is redundant - I already have one in my course. I decided to have the course do away with the whole SLK framework UI. I do this when I launch the course:

top.document.getElementById('framesetOuter').rows = '0,*'; // This removes the title frame on the top. You can omit this if you want to keep the title. 

var framesets = top.document.getElementById(top.MAIN_FRAME).contentWindow.document.getElementsByTagName('FRAMESET');

for (var f = 0; f < framesets.length; f++){

if(framesets[f].rows != ''){

framesets[f].rows = framesets[f].rows.replace(/\d+/g, 0);

framesets[f].rows = framesets[f].rows.replace(/[\%]/g, '');

}

if(framesets[f].cols != ''){

framesets[f].cols = framesets[f].cols.replace(/\d+/g, 0);

framesets[f].cols = framesets[f].cols.replace(/[\%]/g, '');

}

}

Then when the student takes the assessment at the end of my course and the course sends the SCORM calls for the score and status, this code silently submits the course without unloading the course:

top.TempIsTrainingComplete = top.API_GetFramesetManager().IsTrainingComplete;

top.TempShowErrorMessage = top.API_GetFramesetManager().ShowErrorMessage;

top.API_GetFramesetManager().IsTrainingComplete = function(){return false;};

top.API_GetFramesetManager().ShowErrorMessage = function(){top.API_GetFramesetManager().ShowErrorMessage = top.TempShowErrorMessage;top.API_GetFramesetManager().IsTrainingComplete = top.TempIsTrainingComplete;};

top.API_GetFramesetManager().DoSubmit();


That way the student can contunue to use the course and interact with it, but when they close the widow, the final score has been submitted without any further action.

We have this exact issue where the CBTs were designed for full screen and now it seems confusing for learners to have all these windows opening. Your work around sounds interesting. Can you tell me exactly were you added your code to keep the frameset from launching and the silent submit? Not exactly clear from your post. Thanks!

Dec 31, 2009 at 3:33 PM

Thank you for your quick response.  I gave this a try today.  I added the first snippet of code in the <HEAD> tag of the lobby.aspx page.

That gives the following error when the page in opened in the browser.

The file '/_layouts/SharePointLearningKit/_layouts/application.master' does not exist.

I also tried adding the code snippet to the frameset.aspx page and that did nothing when the frameset.aspx page was launched.

Maybe it would be helpful if you sent me a sample file of where you inserted your code snippet.

Thanks!

jriesen

From: dcarlile [mailto:notifications@codeplex.com]
Sent: Wednesday, December 30, 2009 5:25 PM
To: Jill Riesenberg (GE)
Subject: Re: Submit Assignment From Flash [SLK:31101]

From: dcarlile

The top snippet of code should be run when your course launches. The easiest way is to enclose it in script tags in the html document that the LMS first launches, but you can run the code any time. The second snippet should be run when your student has completed the course. Put it in a function and call the function when your student has completed the course. It depends on your course. If you have an assessment and they have completed it, that would be a good time, or if your student has viewed every page, you could do it then too. It depends on what constitutes a completed course.

Does that answer your question?

Dave Carlile :: sublime media

From: jriesen [mailto:notifications@codeplex.com]
Sent: Wednesday, December 30, 2009 2:45 PM
To: dcarlile@sublimemedia.com
Subject: Re: Submit Assignment From Flash [SLK:31101]

From: jriesen

dcarlile wrote:
Hacking learning management systems is a hobby of mine, and I hate the fact that my learners have to click a submit button for a single SCO aggregation. Also, since it is a single SCO aggregation, there is no need for the navigation pane at all, and the title is redundant - I already have one in my course. I decided to have the course do away with the whole SLK framework UI. I do this when I launch the course:

top.document.getElementById('framesetOuter').rows = '0,*'; // This removes the title frame on the top. You can omit this if you want to keep the title.

var framesets = top.document.getElementById(top.MAIN_FRAME).contentWindow.document.getElementsByTagName('FRAMESET');

for (var f = 0; f < framesets.length; f++){

if(framesets[f].rows != ''){

framesets[f].rows = framesets[f].rows.replace(/\d+/g, 0);

framesets[f].rows = framesets[f].rows.replace(/[\%]/g, '');

}

if(framesets[f].cols != ''){

framesets[f].cols = framesets[f].cols.replace(/\d+/g, 0);

framesets[f].cols = framesets[f].cols.replace(/[\%]/g, '');

}

}

Then when the student takes the assessment at the end of my course and the course sends the SCORM calls for the score and status, this code silently submits the course without unloading the course:

top.TempIsTrainingComplete = top.API_GetFramesetManager().IsTrainingComplete;

top.TempShowErrorMessage = top.API_GetFramesetManager().ShowErrorMessage;

top.API_GetFramesetManager().IsTrainingComplete = function(){return false;};

top.API_GetFramesetManager().ShowErrorMessage = function(){top.API_GetFramesetManager().ShowErrorMessage = top.TempShowErrorMessage;top.API_GetFramesetManager().IsTrainingComplete = top.TempIsTrainingComplete;};

top.API_GetFramesetManager().DoSubmit();


That way the student can contunue to use the course and interact with it, but when they close the widow, the final score has been submitted without any further action.

We have this exact issue where the CBTs were designed for full screen and now it seems confusing for learners to have all these windows opening. Your work around sounds interesting. Can you tell me exactly were you added your code to keep the frameset from launching and the silent submit? Not exactly clear from your post. Thanks!

Read the full discussion online.

To add a post to this discussion, reply to this email (SLK@discussions.codeplex.com)

To start a new discussion for this project, email SLK@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Read the full discussion online.

To add a post to this discussion, reply to this email (SLK@discussions.codeplex.com)

To start a new discussion for this project, email SLK@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

The information contained in this message is confidential. If you are not the intended recipient, dissemination or copying of this information is prohibited.

If you have received this communication in error, please notify the sender and delete the message from your system. Thank you.
Dec 31, 2009 at 9:54 PM

jriesen-

I think I know where the confusion lies - The code I posted isn't intended to be included in the SLK and compiled with it. It is intended as a hack for the courses that run in the SLK. It won't function properly until the course framework and the html document indicated in the course manifest is launched. In my courses, I have code that determines that the course is running in the SLK by looking for tell-tale signs in the DOM, then runs the code to modify the frameset.

Jan 1, 2010 at 7:45 PM

dcarlile - thank you for the clarification.  I was able to successfully insert your code into the html file that is listed in the course manifest and "wha-la" the frameset closes.  :-)  One issue down and one to go, the submisson of the score.  I am still having trouble understanding the implementation of your code snippet to silently submit the score to the SLK.  You said, "The second snippet should be run when your student  has completed the course. Put it in a function and call the function when your student has completed the course."  I am not a developer so you lost me here.  If you think you could explain this more specifically or supply a bigger piece of sample code where you have used this, that might help significantly.  Or, would you suggest just using the javascript snippet provided by baden03...

top.frames[1].frames[1].document.getElementById('aSUBMIT').click();

that gets added to a button at the end of the course assessment?

Thanks again for you help.  Your code really saved us!  :-)

jriesen

Jan 4, 2010 at 9:42 PM

jriesen,

"top.frames[1].frames[1].document.getElementById('aSUBMIT').click();" just programatically pushes the button on the page. Even though it is hidden from view because of the code that hides the framework, it is technically still there as far as the browser is concerned. In this code:

top.TempIsTrainingComplete = top.API_GetFramesetManager().IsTrainingComplete;

top.TempShowErrorMessage = top.API_GetFramesetManager().ShowErrorMessage;

top.API_GetFramesetManager().IsTrainingComplete = function(){return false;};

top.API_GetFramesetManager().ShowErrorMessage = function(){top.API_GetFramesetManager().ShowErrorMessage = top.TempShowErrorMessage;top.API_GetFramesetManager().IsTrainingComplete = top.TempIsTrainingComplete;};

top.API_GetFramesetManager().DoSubmit();

The last line does the same thing as your click() function call. The lines above the DoSubmit get rid of annoying messages from the frameset. What I meant about putting it in a function was something like this:

function SubmitTraining()

{

top.TempIsTrainingComplete = top.API_GetFramesetManager().IsTrainingComplete;

top.TempShowErrorMessage = top.API_GetFramesetManager().ShowErrorMessage;

top.API_GetFramesetManager().IsTrainingComplete = function(){return false;};

top.API_GetFramesetManager().ShowErrorMessage = function(){top.API_GetFramesetManager().ShowErrorMessage = top.TempShowErrorMessage;top.API_GetFramesetManager().IsTrainingComplete = top.TempIsTrainingComplete;};

top.API_GetFramesetManager().DoSubmit();

}

 Put that between script tags where the assessment submit button knows where to find it, and then put SubmitTraining() into the button instead of top.frames[1].frames[1].document.getElementById('aSUBMIT').click().

Before you call this function, you need to make sure the course is done sending all of your assessment score data thorugh the SCORM API, which means you many have to call the function AFTER the Assessment submit button code is run. As for the specifics of how to do that, I can't really go into specifics because I don't know the specifics of your implementation.

Jan 4, 2010 at 9:58 PM

Thank you again for your quick response.  We will run some testing on this to see if this will work in our specific environment.

jriesen

From: dcarlile [mailto:notifications@codeplex.com]
Sent: Monday, January 04, 2010 3:43 PM
To: Jill Riesenberg (GE)
Subject: Re: Submit Assignment From Flash [SLK:31101]

From: dcarlile

jriesen,

"top.frames[1].frames[1].document.getElementById('aSUBMIT').click();" just programatically pushes the button on the page. Even though it is hidden from view because of the code that hides the framework, it is technically still there as far as the browser is concerned. In this code:

top.TempIsTrainingComplete = top.API_GetFramesetManager().IsTrainingComplete;

top.TempShowErrorMessage = top.API_GetFramesetManager().ShowErrorMessage;

top.API_GetFramesetManager().IsTrainingComplete = function(){return false;};

top.API_GetFramesetManager().ShowErrorMessage = function(){top.API_GetFramesetManager().ShowErrorMessage = top.TempShowErrorMessage;top.API_GetFramesetManager().IsTrainingComplete = top.TempIsTrainingComplete;};

top.API_GetFramesetManager().DoSubmit();

The last line does the same thing as your click() function call. The lines above the DoSubmit get rid of annoying messages from the frameset. What I meant about putting it in a function was something like this:

function SubmitTraining()

{

top.TempIsTrainingComplete = top.API_GetFramesetManager().IsTrainingComplete;

top.TempShowErrorMessage = top.API_GetFramesetManager().ShowErrorMessage;

top.API_GetFramesetManager().IsTrainingComplete = function(){return false;};

top.API_GetFramesetManager().ShowErrorMessage = function(){top.API_GetFramesetManager().ShowErrorMessage = top.TempShowErrorMessage;top.API_GetFramesetManager().IsTrainingComplete = top.TempIsTrainingComplete;};

top.API_GetFramesetManager().DoSubmit();

}

Put that between script tags where the assessment submit button knows where to find it, and then put SubmitTraining() into the button instead of top.frames[1].frames[1].document.getElementById('aSUBMIT').click().

Before you call this function, you need to make sure the course is done sending all of your assessment score data thorugh the SCORM API, which means you many have to call the function AFTER the Assessment submit button code is run. As for the specifics of how to do that, I can't really go into specifics because I don't know the specifics of your implementation.

Read the full discussion online.

To add a post to this discussion, reply to this email (SLK@discussions.codeplex.com)

To start a new discussion for this project, email SLK@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

The information contained in this message is confidential. If you are not the intended recipient, dissemination or copying of this information is prohibited.

If you have received this communication in error, please notify the sender and delete the message from your system. Thank you.