RESOLVED: Add input fields to end of quiz / games
Submitted by SFMichael on Fri, 02/20/2015 - 13:52
Forums:
hello,
I am looking to add a text field to the end of the quiz and several games so that the user can enter a name. On click of a submit button the username name and score will be stored to a wordpress DB.
I'm pretty handy with my coding I just need a starting point in the API if someone could tell me where to start looking.
Ideal there was some end point I could hook into.
Regards
Michael
falcon
Fri, 02/20/2015 - 15:16
Permalink
I don't know where you want
I don't know where you want to place your input field. If you add this js:
H5P.externalDispatcher.on('xAPI', function(event) {if(event.getVerb() === 'completed') {alert('completed');}});
You'll get triggered when an H5P has been completed and you may for instance display a popup where the user is to input his name.
SFMichael
Fri, 02/20/2015 - 15:19
Permalink
That sounds like it may do
That sounds like it may do the trick. I'll hook it up and update this post shortly.
SFMichael
Fri, 02/20/2015 - 16:55
Permalink
Worked like a charm, works
Worked like a charm, works quite nice with jQuery UI as well. Probably would prefer it to be displayed on the result slide, So may try appending it to there instead.
Once thing though: Since I added the wordpress plugin my site will randomly die and go to browser error page but fix itself on refresh. Anyone else experienced this?
falcon
Mon, 02/23/2015 - 09:25
Permalink
We haven't experienced it.
SFMichael
Mon, 02/23/2015 - 10:16
Permalink
I havn't worked out the
I havn't worked out the exact parameters of when it happens. Its odd. Can't get it to do it today.
SFMichael
Mon, 02/23/2015 - 14:54
Permalink
Not to worry at the minute
Not to worry at the minute still havn't got replicated this today.
One last question:
Is there a way I can get the element (H5P Activity Container) that fires 'H5P.externalDispatcher.on('xAPI', function(event){}):'
Everything seems to be working just need this to future prove the scenerio if / when there are two H5P Activities on one page.
SFMichael
Mon, 02/23/2015 - 15:07
Permalink
Sorted..Excellent library
Sorted..
Excellent library keep up the good work
falcon
Tue, 02/24/2015 - 09:51
Permalink
Ok, you found the answers to
SFMichael
Tue, 02/24/2015 - 09:59
Permalink
Yes got all my answers (for
Yes got all my answers (for now), Now any one can save their score after finishing an activity and I can also display the latest five scores in a widget for a particular activity. Thanks for the help. Really like the library. Keep up the good work