Inserting a <form> </form>

6 posts by 3 authors in: Forums > CMS Builder
Last Post: April 14, 2008   (RSS)

By dan_999 - April 14, 2008

Hi,
I've just started using CMS Builder today and so far so good! Looks like this is going to be a really easy way of giving clients access to update their pages.

A quick question though.

I've set a content section up as WYSIWYG but when I go to the HTML view and type in my <form> code, as soon as I switch to normal view it seems to strip it all out.

Have I missed an option somewhere?

thanks
http://www.thisishartlepool.co.uk

Re: [dan_999] Inserting a <form> </form>

By Dave - April 14, 2008

It looks like the wysiwyg editor (tinyMCE) strips those out by default. If you're comfortable editing the PHP you can turn that feature off. Here's how:

- Open /lib/menus/default/edit_functions.php
- Make a backup copy of that file
- Search for 'entity_encoding'
- After that line, add this line (in red):

entity_encoding : "raw", // ...
extended_valid_elements : "form[action|accept|accept-charset|enctype|method]",


Then save that file and reload your editor and you should be able to enter form tags in the HTML.

Hope that helps, let me know if you have any further problems with that or need more assistance.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Inserting a <form> </form>

By dan_999 - April 14, 2008

Hi Dave,
Thanks - getting there I think.

That seems to keep my form opening and closing tags but now my <input> <textarea> and <select> bits of the form are being stripped out.
http://www.thisishartlepool.co.uk

Re: [dan_999] Inserting a <form> </form>

By InHouse - April 14, 2008

Sounds like you'll have to repeat the above process for each of the form entities you don't want the editor to strip out. On the plus side, you only have to do this once... until the next update. [;)]

J.

Re: [dan_999] Inserting a <form> </form>

By Dave - April 14, 2008

There's some more docs on these configuration options here:
http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/valid_elements
http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/extended_valid_elements

But for a quick fix, this should allow all tags:

entity_encoding : "raw", // ...
extended_valid_elements : "*[*]",


I tested it locally and that worked with the input, textarea and other tags. Let me know if it does the trick.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Inserting a <form> </form>

By dan_999 - April 14, 2008

Spot on thanks - the * thing will certainly help me out for next time I try something else.

cheers
http://www.thisishartlepool.co.uk