Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » HTMLEditor fields not saving

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1831 Views
  • NickJacobs
    Avatar
    Community Member
    144 Posts

    HTMLEditor fields not saving Link to this post

    Hi, Ive got a page (homepage) which has three defined columns and I'm trying to setup 3 htmleditor fields to manage the text....but they are not saving. I may be missing something obvious...any help out there? This is what I have:

    class HomePage extends Page {
       
       static $db = array(
    '$homeCol1' => 'HTMLText',
    '$homeCol2' => 'HTMLText',
    '$homeCol3' => 'HTMLText'

    );
       
       static $has_one = array(
    );

    function getCMSFields() {
    $fields = parent::getCMSFields();

    $fields->addFieldToTab("Root.Content.Main", new HtmlEditorField("homeCol1","Investment-Intro"),"Content");
    $fields->addFieldToTab("Root.Content.Main", new HtmlEditorField("homeCol2","Reserves-Intro"),"Content");
    $fields->addFieldToTab("Root.Content.Main", new HtmlEditorField("homeCol3","Distribution-Intro"),"Content");

    $fields->removeFieldFromTab("Root.Content.Main","Content");    
    return $fields;
    }

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: HTMLEditor fields not saving Link to this post

    Looking at yr code, I see you're using a dollar sign as db fieldnames,while not as names for your form fields

    compare $homeCol1 with HtmlEditorField("homeCol1" ...

    I suggest you leave out the $.

    I'd also put it in different tabs, someone may get confused perhaps when you use tinymce on 3 fields at once?

  • NickJacobs
    Avatar
    Community Member
    144 Posts

    Re: HTMLEditor fields not saving Link to this post

    haha...quite right, silly mistake !.

    thanks for that, and yes, I added them to individual tabs and it works much better.

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