How to add html in confirmation messages
Submitted by Miquel Fuster on Thu, 12/28/2017 - 12:59
Forums:
I want to add some html code in confirmation, thank you,etc... messages in a quiz. Is it possible?.
I need to add a link to the next quiz if they pass the first one.
Thanks a lot
Miquel
BV52
Thu, 12/28/2017 - 14:26
Permalink
Hi Miquel,Currently this is
Hi Miquel,
Currently this is not possible with the contents. The good news is H5P is open source so you or anyone in the community can make their own changes. This document is a good starting point.
-BV52
Miquel Fuster
Thu, 12/28/2017 - 17:48
Permalink
OK. Thanks. I'm not a
OK. Thanks. I'm not a developer, but I'll take a look to the document.
Thanks again.
Miquel
BV52
Fri, 12/29/2017 - 06:26
Permalink
Hi Miquel,I think this is a
Hi Miquel,
I think this is a very nice suggestion and I hope someone from the community picks this up and create the feature for us :-)
-BV52
Miquel Fuster
Tue, 01/02/2018 - 17:00
Permalink
I tried to write a custom
I tried to write a custom module with this code
It converts the feedback option in an HTML widget, but a warnings messages are showed when I save the content:
and when the Quiz are finished the feedback message still showing as a plain text with the html tags.
Please, can you (or anybody) help me?
thomasmars
Thu, 01/04/2018 - 16:47
Permalink
Hi, I'm not able to reproduce
Hi, I'm not able to reproduce this. It looks like there's something wrong with your semantics, since the group sent to validation is not able to validate.
Can you tell us more about what you have included in your H5P content, and when this error occurs, and what you have done before that ?
I'm not sure how you're getting the error, but you can not modify the widget of the feedback text inside the RangeList if that is what you're trying to do, since it is already being rendered by the RangeList widget, which does not allow modifications to its fields. Sorry about that.
It might also be useful to know that you should supply all tags that should be rendered for a 'html' widget to validate.
Miquel Fuster
Thu, 01/04/2018 - 17:22
Permalink
Hi Thomas,I have included a
Hi Thomas,
I have included a Question Set with a Multiple Choice Question in my H5P content. The error occurs when I save the content.
Yes, as you say, I'm trying to modify the widget of the feedback text inside the RangeList. I want to insert html content instead of plain text in feedback text. My idea is to insert a link depending on the final punctuation. Is it possible to do? Can you help me? I think that it can be a nice and useful feature for another H5P users.
Thank you very much for your time and I wish you a very happy and nice 2018.
Miquel
P.S. I'm sorry, but I don't undestand what is the minning of this: "It might also be useful to know that you should supply all tags that should be rendered for a 'html' widget to validate" .
thomasmars
Fri, 01/05/2018 - 09:28
Permalink
Hi, I don' think you'll be
Hi, I don' think you'll be able to change the feedback text input field to have a wysiwyg editor without actually changing the RangeList widget, which is probably not what you want.
What you can do, if you just want to add a static link depending on what is in the semantics, you can use the h5p_filtered_params_alter() hook instead, this will allow you to alter semantics before they are displayed. You can then alter the feedback field in semantics and add a link there.
My line about supplying "tags" attribute, means that if you're changing the widget of a "text" type semantic to "html", you should also provide a list with the allowed "tags" for that field. See for instance https://github.com/h5p/h5p-blanks/blob/master/semantics.json#L30-L40.
I urge you to play around with the different hooks to see what is possible.
Best regards, Thomas