Jump to:

23453 Posts in 18902 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Textarea field

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: 2040 Views
  • Nickname123
    Avatar
    Community Member
    6 Posts

    Textarea field Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: Textarea field Link to this post

    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.

  • Nickname123
    Avatar
    Community Member
    6 Posts

    Re: Textarea field Link to this post

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

  • martimiz
    Avatar
    Forum Moderator
    1078 Posts

    Re: Textarea field Link to this post

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

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: Textarea field Link to this post

    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.

  • Nickname123
    Avatar
    Community Member
    6 Posts

    Re: Textarea field Link to this post

    That worked perfectly, thanks will!

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