Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

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

Textarea field


6 Posts   2080 Views


22 February 2011 at 5:24am Community Member, 6 Posts

Hi guys,

I'm have a small problem usinf the textare field in the admin, the problem is I'm using two textareafields so that I can insert custom css and javascript on a specific page type, the only issue is that it inserts line breaks, paragraph tags and such rather than just plain text.

Any advice would be good thanks.


22 February 2011 at 10:13pm Forum Moderator, 5511 Posts

Does it store it formatted like that in the database? (check your database) or is it converting the line breaks etc on the front end? If you're using a TextaraField (over a HtmlEditorField) your database field should be 'Text' rather than html text.


23 February 2011 at 2:28am Community Member, 6 Posts


Thanks for the reply, The database looks fine, it's not displaying tags and it's showing " rather than " which is how I'd like, so it's just somehow being pushed out as hmtl.

I'm using this..

'InsertCSS' => 'Text',

$fields->addFieldToTab('Root.Content.Main', new TextareaField('InsertCSS', 'Insert css'),'Content');


24 February 2011 at 9:48am Forum Moderator, 1095 Posts

Did you try to use 'InsertCSS' => 'HTMLText' instead?

HTMLText adds HTML only if you manually add tags to the Textarea field, whereas Text seems to try and convert linefeeds and stuff to HTML...


24 February 2011 at 3:11pm Forum Moderator, 5511 Posts

If the front end is pushing out the wrong thing try $InsertCSS.RAW to get the raw content from the db. Note you shouldn't use RAW for some user input as it can exploit the website.


24 February 2011 at 11:32pm Community Member, 6 Posts

That worked perfectly, thanks will!