Monday, April 05, 2010

Sitecore Rich Text Field - Iframe gotcha

If you ever tried putting an iframe in the Rich Text Field, you probably got what I got:

Server Error in '/' Application.
Empty strings are not allowed.
Parameter name: name

To solve this you have at least two options:
1. Wrap your iframe with the xsl:template definition. This way the iframe will appear as a web control in the rich text editor, but will render fine on the content delivery.
<xsl:template match="*" mode="main">
     <iframe id="iframe" src="..."></iframe>

2. Turn off HtmlEditor.SupportWebControls setting in web.config:
<setting name="HtmlEditor.SupportWebControls" value="false"/>

The second option makes more sense since you don’t need to alter the rich text content. If you don’t paste webcontrols to the rich text field, go for it.


lolmarkwell said...

Thank you so much for this, you saved my life!

kaalen said...

Does changing the HtmlEditor.SupportWebControls have any negative side effects?

Mark Ursino said...


The comment in the web.config about that setting just says "Indicates if the Html Editor supports web controls. If true, Web Controls are shown as yellow boxes." Based on Alex's note and this comment, it sounds like there are no side effects other than not allowing embedded webcontrols.

Alex Shyba said...

Thanks Mark!

Ram said...

Thank you so much. It works nicely.

c0x3y said...

Cheers fella. Worked a treat

c0x3y said...

Cheers fella. Worked a treat.

Los said...

i don't have acces to the web.config i tryed the first method but i keep getting the same error. any suggestions as to why the option 1 wouldn't work?

Sahil said...

Yes i have also tryed the first method, but got the same error again. I want to open my sublayout, but always got the same error. I am using iFrame in my source code. Website is working fine but i am unable to do any edit from sitecore CMS