Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Error saving content

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

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

Page: 1 2
Go to End
Author Topic: 9262 Views
  • noizy
    Avatar
    Community Member
    25 Posts

    Error saving content Link to this post

    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?

  • noizy
    Avatar
    Community Member
    25 Posts

    Re: Error saving content Link to this post

    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.

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: Error saving content Link to this post

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

  • noizy
    Avatar
    Community Member
    25 Posts

    Re: Error saving content Link to this post

    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.

  • noizy
    Avatar
    Community Member
    25 Posts

    Re: Error saving content Link to this post

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

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: Error saving content Link to this post

    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

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: Error saving content Link to this post

    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

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: Error saving content Link to this post

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

    9262 Views
Page: 1 2
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.