When add an iframe in CMS page. An errer show  "The content field (English (United States)) is invalid."(Prestashop 1.5.5 clean install)

But in 1.5.4.1 is work fine. Is there anybody can solve this probem?

Best regards.

But It's not working.

"back office-->preferences-->general --> allow iframes in html= yes "

This function is work only for product description.

but in CMS page the iframe is still not allowed.

okay, thanks for information, in last several days i've noticed many posts related to this issue and in some of them this helped.

anyway, can you use this: extend tinymce options

+ make sure that you've got in class/cms.php in object definition this code:

'content' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml', 'size' => 3999999999999),

I've try TinyMCE editor and checked in class/cms.php

but in CMS page the iframe is still not allowed. :D

Look like prestashop 1.5.5 system is not allowed iframe in to the cms database table.

But It's ok. I'll roll back to 1.5.4.1 temporary.

Solved

In prestashop\classes\Validate.php

line 392  At

public static function isCleanHtml($html, $allow_iframe = false)

comment out this code

if (preg_match('/<[\s]*script/ims', $html) || preg_match('/('.$events.')[\s]*=/ims', $html) || preg_match('/.*script\:/ims', $html))             return false;         if (!$allow_iframe && preg_match('/<[\s]*(i?frame|form|input|embed|object)/ims', $html))             return false;

thanks for solution! it will be helpful for whole community :)

im going to mark this topic as solved

best regards

I am trying to embed a video in the page content of the CMS page and it seems to be having the same issue.  It wont work and gives me this error at the top of the page: The content field (English (United States)) is invalid.  I am using 1.5.5.0 I have the iframe option turned on under the general options.

if (preg_match('/<[\s]*script/ims', $html) || preg_match('/('.$events.')[\s]*=/ims', $html) || preg_match('/.*script\:/ims', $html))             return false;         if (!$allow_iframe && preg_match('/<[\s]*(i?frame|form|input|embed|object)/ims', $html))             return false;

What do you mean wit h '' comment out this code ''

and what do you changed in this row?

Same problem over here...

take a look here: http://mypresta.eu/en/art/developer/prestashop-product-page-full-rich-editor.html#validate_class_change

comment code mean that you have to use comment signs /*   */

this is

commented

and it will not

be executed

take a look here: http://mypresta.eu/en/art/developer/prestashop-product-page-full-rich-editor.html#validate_class_change

comment code mean that you have to use comment signs /*   */

this is

commented

and it will not

be executed

Thanks, it works.

Vekia,

Can you look at this post?  My store is  having other issues after chaning the validate.php code.

http://www.prestashop.com/forums/topic/279096-validation-error-causing-data-not-to-save/?hl=%2Bcompilation+%2Bfailed

Jonathan

Thanks! Your solve of commenting out works, but has resulted in an annoying bug:

Every time I save the page with a Youtube movie, it links to a blank white page. It updates it, but somehow doesn't go back to the original menu.

Any thoughts on this issue?

I am running my shop on an older version of prestashop Version 1.3.2.3

I am having trouble adding an iframe to the CMS page. Can some please help show me how to modify the CMS page to ignore or restore the iframe tag...?

Thank you,

you use a bit old ps version, all tutorials here will not work for you.

Please describe what kind of problems you've got in your 1.3.x version while you're trying to add iframe to cms page

some error messages?

When I try saving the iframe code in the html source editor it comes back blank after saving/updating.

The editor wont recognize the iframe code...? Is there a way around this? Please walk me through the steps and code that needs to be editor in order to allow iframe on CMS pages with my old prestashop version 1.3.2.3.

Thanks you for your help.

The editor wont recognize the iframe code...? Is there a way around this? Please walk me through the steps and code that needs to be editor in order to allow iframe on CMS pages with my old prestashop version 1.3.2.3.

Thanks you for your help.

Should iscleanhtml part look like this now?

public static function isCleanHtml($html, $allow_iframe = false)
return true;
if (preg_match('/<[\s]*script/ims', $html) || preg_match('/('.$events.')[\s]*=/ims', $html) || preg_match('/.*script\:/ims', $html))
return false;
if (!$allow_iframe && preg_match('/<[\s]*(i?frame|form|input|embed|object)/ims', $html))
return false;
Thanks in advance

I also have the problem on 1.5.6.1! I have html/javascript code in some cms pages to show a slideshow and nothing work now :(

i allowd iframes, i modified validate.php ... but nothing work....

So stupid that we have to fight to do something so basic

Anyone solved this problem?

ok i frames seem to work but not other code... i used to have in my cms page some code (this one http://www.prestashop.com/forums/topic/301213-js-script-for-adding-slideshow-anywhere-you-need/?p=1548708 ) to have a slideshow but impossible to make it work....

I followed also this link http://mypresta.eu/en/art/know-how/tinymce-editor-full-options-all-html-tags.html

sorry, but this iframe problem is still not solved.

Even if you allow iframes and modify the validate.php.

I try to implement a simple Google Maps iframe. Nothing special.

Has anyone a solution?

To all, instead of directly edit "/classes/Validate.php", you should add an override in "/override/classes".

Get the attached file and copy it in "/override/classes/" folder.

Then, delete the override cache file "/cache/class_index.php".

This is the same modification from Angrycat but in a more clean way.

Beware of this manipulation : you'll disable the "allow iframe" option in "Admin > General". Iframe will be allowed in all content "protected" by "Validate::isCleanHtml()" even if you disable it in the "Admin > General" tab.

Validate.php

Hi there. I have a similar problem, but the issue is the following:

I enabled Iframes on Prestashop 1.6 and html ones work perfect.

Hatowever, when I try to insert a javascript iframe, system doesn't allow this. The fact is that I want to insert a booking search engine iframe. The code of the search box is as follow:

<script language='Javascript' src=' http://www.bookhostels.com/files/index.php?UserID=zzzzzzzzzzzzzz&File=bighw&Language=Spanish&Currency=EUR&NewWindow=0&PropTypeSelect=1 '></script>

How can I insert this little javascript code as an iframe into a Cms Prestashop page?

prestashop tinymce editor by default doesnt allow to use <script> tags.

in this case it's necessary to extend it

here on forum you can find several solutions related to "extending tinymce in 1.6"

Same problem Can't embed video mp4 to cms page PS1.6.0.9 did everything mentioned here . Any solution&

what code you use to embed it?

Bonjour,

Je voudrais insérer ce code sur une de mes pages CMS comment puis-je faire SVP ? : < script type = "text/javascript" src = " http://services.supportduweb.com/comments/12040.js " > </ script > < a href = " http://www.supportduweb.com/service-module-commentaires-gratuit-messages-visiteurs-module-script-systeme-commentaires-gratuit.html " > Module de Commentaires </ a >

I have version 1.6.0.14 and this problem still has not been fixed!

I was able to fix commenting the code; (Validate.php)

if (preg_match('/<[\s]*script/ims', $html) || preg_match('/('.$events.')[\s]*=/ims', $html) || preg_match('/.*script\:/ims', $html))
return false;
if (!$allow_iframe && preg_match('/<[\s]*(i?frame|form|input|embed|object)/ims', $html))
return false;

Using PS 1.4.0.17

Same problem here, when adding <iframe> code in HTML, after saving the HTML field is blanc. It doesn't save the <iframe> code. It does save an other random HTML code.

In Preferences there is no option for able/disable iframes.

My codes in Validate.php look different then examples mentioned in this topic before.

Thanks for your help.

Hope im not digging up an old thread but this is rather easy to fix. Just open up phpMYadmin and expand your prestashop database. Mine would be labeled as "pr." Inside that is a lot of tables called ps_

Look for: ps_cms_lang

And all your CMS pages will load. Click on edit on the page you want to add the HTML code to. Paste in the code to the big box at the bottom. And then when your done scroll down and make sure save is selected from the drop down menu and click on go.

Viola you just bypassed prestashop

Thank me later


I had a custom theme created many years ago on version 1.3.2.3


I am trying to allow iframe in CMS pages but I am unable to.


These is no option in preferences to allow iframe and I dont see anywhere in validate.php the iframe.


This is what i see:


static public function isCleanHtml($html)

$jsEvent = 'onmousedown|onmousemove|onmmouseup|onmouseover|onmouseout|onload|onunload|onfocus|onblur|onchange|onsubmit|ondblclick|onclick|onkeydown|onkeyup|onkeypress|onmouseenter|onmouseleave';

return (!preg_match('/<[ \t\n]*script/ui', $html) && !preg_match('/<.*('.$jsEvent.')[ \t\n]*=/ui', $html)  && !preg_match('/.*script\:/ui', $html));

Can someone please help me out to get the iframe going?

Thanks,

Barry

Good afternoon, I tried everything you said and even then I can not insert my youtube video into my CMS page. I would like a little help. I am using prestashop version 1.7. I apologize for my English.

Good afternoon, I tried everything you said and even then I can not insert my youtube video into my CMS page. I would like a little help. I am using prestashop version 1.7. I apologize for my English.

Hello,

i cannot find "enable iframe" option in the administration/preferences/general tab.

im using prestashop 1.5.3.1

There are only 4 options available in it.

1. Automatically check for module updates

2. Check IP on the cookie

3. Lifetime of the Front Office cookie

4. Lifetime of the back Office cookie

I want to add a virtual reality image onto my contact us page of our website.