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.

Archive /

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

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

HTMLEditor fields not saving


Go to End


3 Posts   2574 Views

Avatar
NickJacobs

Community Member, 148 Posts

25 May 2008 at 11:25pm

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;
}
   
 

Avatar
dio5

Community Member, 501 Posts

26 May 2008 at 7:19am

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?

Avatar
NickJacobs

Community Member, 148 Posts

30 May 2008 at 1:11pm

haha...quite right, silly mistake !.

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