How to use the setFeedback() function

papi Jo's picture


I am working on a H5P content which is not a question type. At the end of the activity I need to display a score. I can use the scorebar without any problem, like this:

scoreBar = JoubelUI.createScoreBar(maxScore);

But I would like to add a score explanation to the score bar. I think that I need to use the setFeedback() function which resides in the H5P.Question-1.4 library. I have added it to my own library in the preloadedDependencies section.

But when I call the setFeedback() function (with the relevant parametres) I get this error message:

TypeError: this.setFeedback is not a function

What can I do? Thanks in advance.

otacke's picture

Hi Papi Jo!

H5P.Question is just a bunch of handy functions bundling common tasks (defining buttons, etc.) that you'd otherwise have to do manually - like setting up the score bar. It's not needed however. If I am not mistaken, the 4th parameter of JoubelUI.createScoreBar is what you are looking for and essentially only passes the arguments to the constructor of JoubelScoreBar.

If you want to switch to H5P.Question anyway: Your class (what this is referencing to) will have to extend H5P.Question so your class will inherit H5P.Question's functions. The basics are described in the readme.


papi Jo's picture

Thanks for your reply. Just what I needed! No need to use H5P.Question.


otacke's picture

You're welcome!