21278 Posts in 5728 Topics by 2599 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2464 Views |
-
Error Saving Content with Html Editor Field

20 September 2009 at 8:23am Last edited: 20 September 2009 8:32am
I don't know if these 2 problems are related but i have having a problem with content not saving when i click save or save and publish on one of my page types called InsidePage. All my other templates work just great.
Here is my code for the InsidePage Template.
<?php
/**
* Defines the InsidePage page type
*/class InsidePage extends Page {
static $db = array(
'Email' => 'Text',
'Phone' => 'Text',
'Location' => 'Text',
'Webstie' => 'Text',
'Twitter' => 'Text',
'Facebook' => 'Text',
'Flickr' => 'Text',
'StudentDevelopment' => 'HTMLText',
'Sustainability' => 'HTMlText',
'Diversity' => 'HTMLText'
);static $has_one = array (
);function getCMSFields() {
$fields = parent::getCMSFields();$fields->addFieldToTab('Root.Content.Contact', new TextField('Phone'));
$fields->addFieldToTab('Root.Content.Contact', new TextField('Email'));
$fields->addFieldToTab('Root.Content.Contact', new TextField('Location'));
$fields->addFieldToTab('Root.Content.Links', new TextField('Website'));
$fields->addFieldToTab('Root.Content.Links', new TextField('Twitter'));
$fields->addFieldToTab('Root.Content.Links', new TextField('Facebook'));
$fields->addFieldToTab('Root.Content.Links', new TextField('Flickr'));$fields->addFieldToTab('Root.Content.StudentDevelopment', new HtmlEditorField("StudentDevelopment","GreyboxContent"));
$fields->addFieldToTab('Root.Content.Sustainability', new HtmlEditorField("Sustainability","GreyboxContent"));
$fields->addFieldToTab('Root.Content.Diversity', new HtmlEditorField("Diversity","GreyboxContent"));return $fields;
}}
class InsidePage_Controller extends Page_Controller {
}
?>I think the problem is happening when i add the HtmlEditorFields to the CMS because when I comment out those lines run a dev/build and reload the admin everything works just great. could someone help me with this?
/**
$fields->addFieldToTab('Root.Content.StudentDevelopment', new HtmlEditorField("StudentDevelopment","GreyboxContent"));
$fields->addFieldToTab('Root.Content.Sustainability', new HtmlEditorField("Sustainability","GreyboxContent"));
$fields->addFieldToTab('Root.Content.Diversity', new HtmlEditorField("Diversity","GreyboxContent"));
**/ -
Re: Error Saving Content with Html Editor Field

20 September 2009 at 10:46am
some inconsistencies (may or may not actually help)...
- Website not Webstie
- HTMLText not HTMlText
- HTMLEditorField not HtmlEditorField
- change your double quotes to single quotesAlso should some of those fields be Varchar instead of Text?
-
Re: Error Saving Content with Html Editor Field

21 September 2009 at 6:08am
Tried all of those still no go. I would really like to get this fixed but I'm pretty new to Silverstripe and i wouldn't know how to tackle this.
Can anyone else take a stab at it?
-
Re: Error Saving Content with Html Editor Field

22 September 2009 at 3:21pm
I guess I could supply a little more information.
Version: SS 2.3.3
Installed Modules: DataObjectManger, SIFR, and SWF UploadI would really like to know what is wrong with my code, I've just started Silverstripe and love it and I would hate to have to use text area fields over HTMLEditorField.
-
Re: Error Saving Content with Html Editor Field

22 September 2009 at 6:12pm Last edited: 22 September 2009 6:14pm
Did you really check the syntax on all items? It's HTMLText not HTMlText!
I copied your class, tidied up and it works... (I also used addFieldsToTab instead of addFieldToTab, it's easier to add multiple fields to one tab this way)Here's the code: http://pastebin.com/m4bea5262
Update Oh yeah, and I changed your Text members to Varchar. If you really need more than 256 chars per field, you can change it back of course.
| 2464 Views | ||
|
Page:
1
|
Go to Top |



