ifame tag in question body

ifame tag in question body

by Yaniv Cohen -
Number of replies: 7

Hi,

For some reason the questionnaire module ignores an iframe tag in the question body.

Is that a bug?

Average of ratings: -
In reply to Yaniv Cohen

Re: ifame tag in question body

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi yaniv,
Are you able to put iframe tags in other HTML fields in your moodle's other modules?
We need to know if the problem is Questionnaire-specific.
Can you please post an example.
Joseph
In reply to Joseph Rézeau

Re: ifame tag in question body

by Yaniv Cohen -

There is no problem using iframe tags in quiz questions.

 Even in a questionnaire 'label' it's working.

Apparently  there is a differance between the label "question" and all the other questions. 

 

In reply to Yaniv Cohen

Re: ifame tag in question body

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

It so happens that the question text is "cleaned", i.e. formatted as HTML before being displayed. I expect the reason for this cleaning is for safety, but I'm not sure.

If you want to change this on your moodle site, just change the line in mod/questionnaire/questiontypes/questiontypes.class.php, around line 800 as shown below. And you can vote for bug report CONTRIB-1769 .

Joseph


Attachment image00.jpg
In reply to Joseph Rézeau

Re: ifame tag in question body

by Yaniv Cohen -

Thank you Joseph!

This can't be a security issue since a core module like quiz has no such restriction.

And it's not even consistent in the questionnare module because the 'label' element accepts the iframe tag.

I think it should be changed for consistency with other modules and whithin the questionnaire module itself.

In reply to Joseph Rézeau

Re: ifame tag in question body

by Yaniv Cohen -

I think I know why the 'format_text' function was in use.

I don't know how this function actually works but disabling it causes the lang tag ( <span class="multilang" lang="XX"> ) to stop working. However, it does not impact other html code I checked (bold, image, etc).

So the solution you suggest Joseph, enables the iframe tag but disables the lang tag and the current situation enables the lang tag but disables the iframe tag.

If I'm right and 'format as html' is not necessary for processing any html code but the lang tag, then it should be removed and a different solution for including the lang tag should be found.

What do you think Joseph?

In reply to Yaniv Cohen

Re: ifame tag in question body

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Yaniv,

Thanks for pointing out the problem, Yaniv. Currently I cannot think of a solution which would allow both lang tags and iframes. I have not idea what proportion of Questionnaire users need one or the other or both.

So, for the time being, and until a satisfactory solution is found, I propose to keep the Questionnaire code as it is (and not enable iframes). If you don't need the multilang facility but need iframes, then you can always make the necessary changes to your Moodle site.

All the best,

Joseph

In reply to Joseph Rézeau

Re: ifame tag in question body

by Samuel Joya -

Hello Joseph

I am using the Questionnaire and I have a problem using an iframe into a question. When I 'm working on the html editor , I can see the iframe but when the question is run, the iframe is removed. I read somewhere that could change something in the code so that this doesn't happen, in the anterior post, you mentioned around the line 800 but in my actual version, the code is different, I need your help with this issue. Thanks very much, the Questionnaire version is 2.6.7 (Build - 2015031901) (2014041804)