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

Error saving content


Go to End


14 Posts   10504 Views

Avatar
noizy

Community Member, 25 Posts

13 February 2007 at 4:20pm

Hey guys,

I'm just running through the #2 tutorial (http://doc.silverstripe.com/doku.php?id=tutorial:2-extending-a-basic-site) and have started to create some ArticlePages.

The problem I'm having is that when I go save the draft of a newly created ArticlePage, I get a big red "Error saving content" box down in the bottom right of the corner of the screen.

The draft *is* getting saved though - if I refresh the CMS 'My Site' view - the page that triggered the error is correctly listed as being in draft mode, and I can successfully publish from there.

So, not quite sure what's going on - I'm pretty sure I've followed the instructions accurately, here's my ArticlePage.php

<?php
/**
* Defines the ArticlePage page type
*/
class ArticlePage extends Page {

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

$fields->addFieldToTab('Root.Content.Main', new CalendarDateField('Date'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');

return $fields;
}

static $db = array(
'Date' => 'Date',
'Author' => 'Text'
);
static $has_one = array(
);
}

class ArticlePage_Controller extends Page_Controller {

}

?>

...and my ArticleHolder.php...

<?php
/**
* Defines the ArticleHolder page type
*/
class ArticleHolder extends Page {
static $db = array(
);
static $has_one = array(
);

static $allowed_children = array('ArticlePage');
}

class ArticleHolder_Controller extends Page_Controller {

}

?>

The .ss pages are likewise

Running Windows, using the out-of-the-box Windows installer version of SS.

Any ideas?

Avatar
noizy

Community Member, 25 Posts

13 February 2007 at 4:38pm

actually, another odd behaviour while I'm here...

When I save a page, then publish, I get a Published Successfully message.

But then, when I click on another page in the tree structure, I get an 'Unsaved Changes' popup, that prompts me to Save Changes, Discard Changes or Stay on this Page.

I can successfully Save Changes at this point, but I wouldn't have thought I'd've needed to, given I had already just saved and published.

Avatar
Sam

Administrator, 690 Posts

13 February 2007 at 5:01pm

Try visiting db/build?flush=1, and then reloading the admin.

Avatar
noizy

Community Member, 25 Posts

14 February 2007 at 8:55am

Hey Sam,

yeah, the db/build?flush=1 page is my first port of call if anything is going wrong, and despite running the flush, and reloading the admin, the above problems persist.

Avatar
noizy

Community Member, 25 Posts

14 February 2007 at 9:03am

actually, the latter error, where pages were prompting for a Save, despite already having been saved and published, was fixed by running admin/publishall.

Avatar
dio5

Community Member, 501 Posts

12 September 2007 at 2:23am

Any luck on the 'error saving content' issue yet?
I'm experiencing the same behavior. Content seems to be saved though.

Furthermore, maybe a stupid question: when constructing a new HtmlEditorField, is the first parameter $name referring to the database field? Or what is this name for?
I noticed this parameter was left blank in this message: http://www.silverstripe.com/general-discussion/flat/1336

Thanks

Avatar
Sean

Forum Moderator, 922 Posts

12 September 2007 at 2:34am

dio5: for some reason I left the 'RightContent' parameter out. Silly me. But you're right, it is the database name it's referring to. It should read new HtmlEditorField('RightContent', 'Right Content').

Cheers!
Sean

Avatar
dio5

Community Member, 501 Posts

12 September 2007 at 2:54am

Thanks for the quick response... You don't happen to know about the 'error saving content' issue, do you? :-)

Go to Top