Jump to:

23007 Posts in 11856 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » Getting TinyMCE to accept form tags?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1445 Views
  • bkosborne
    Avatar
    Community Member
    3 Posts

    Getting TinyMCE to accept form tags? Link to this post

    Hey everyone

    I need TinyMCE to be able to accept form tags and all the standard HTML input tags. How can I do this? I noticed a lot of people have these issues but there doesn't seem to be a clear answer on the forums anywhere. Thanks

    Brian

  • Willr
    Avatar
    Forum Moderator
    5464 Posts

    Re: Getting TinyMCE to accept form tags? Link to this post

    You can extend the allowed elements by defining your own HtmlEditorConfig option in your mysite/_config.php file. See the cms/_config.php for an example.

    HtmlEditorConfig::get('cms')->setOption(
       'valid_elements' => "form[action],@[id|class|style|title],#a[id|rel|rev|dir|tabindex|accesskey|type|name|href|target|title|class],-strong/-b[class],-em/-i[class],-strike[class],-u[class],#p[id|dir|class|align|style],-ol[class],-ul[class],-li[class],br,img[id|dir|longdesc|usemap|class|src|border|alt=|title|width|height|align],-sub[class],-sup[class],-blockquote[dir|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|dir|id|style],-tr[id|dir|class|rowspan|width|height|align|valign|bgcolor|background|bordercolor|style],tbody[id|class|style],thead[id|class|style],tfoot[id|class|style],#td[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],-th[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],caption[id|dir|class],-div[id|dir|class|align|style],-span[class|align|style],-pre[class|align],address[class|align],-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],-h3[id|dir|class|align|style],-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|dir|class|align|style],hr[class],dd[id|class|title|dir],dl[id|class|title|dir],dt[id|class|title|dir],@[id,style,class]");

  • bkosborne
    Avatar
    Community Member
    3 Posts

    Re: Getting TinyMCE to accept form tags? Link to this post

    Ah okay... Could you explain what the tags mean? Like why do some start with +, -, #, @, etc?

  • MattyJ
    Avatar
    Community Member
    11 Posts

    Re: Getting TinyMCE to accept form tags? Link to this post

    After hours of longdesc being stripped out of HTML editor every time, I found this line entered into mysite/_config.php to work in 2.3.7:

    HtmlEditorConfig::get('cms')->setOption('extended_valid_elements' ,"+img[id|dir|longdesc|usemap|class|src|border|alt=|title|width|height|align]");

    You can probably alter this for forms I would imagine as it overrides the tinymce code. I've got to create a form later so I'll test it then.

    TinyMCE should allow you to enter unfiltered HTML if you really want to. Not everyone has to worry about crazy site authors breaking code and creating security holes. There are hundreds of people wrestling with this issue right now around the globe and tinymce forum admins just flame anyone who questions it! Crazy...but other than that a nice little editor...

    1445 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.