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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Textarea field


Go to End


6 Posts   3683 Views

Avatar
Nickname123

Community Member, 6 Posts

22 February 2011 at 5:24am

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.

Avatar
Willr

Forum Moderator, 5523 Posts

22 February 2011 at 10:13pm

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.

Avatar
Nickname123

Community Member, 6 Posts

23 February 2011 at 2:28am

Hi,

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');

Avatar
martimiz

Forum Moderator, 1391 Posts

24 February 2011 at 9:48am

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...

Avatar
Willr

Forum Moderator, 5523 Posts

24 February 2011 at 3:11pm

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.

Avatar
Nickname123

Community Member, 6 Posts

24 February 2011 at 11:32pm

That worked perfectly, thanks will!