Jump to:

23371 Posts in 18161 Topics by 2865 members

General Questions

SilverStripe Forums » General Questions » Problem with fields in ArticlePage in 2.4.0-rc1

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 1652 Views
  • honeybunny
    Avatar
    Community Member
    79 Posts

    Problem with fields in ArticlePage in 2.4.0-rc1 Link to this post

    I upgraded to 2.4.0-rc1 last night and am having a couple problems with ArticlePages.

    The fist issue is that I get the following message when I try to open ArticlePage files in the cms.

    Fatal error: Class 'CalendarDateField' not found in /home/nhstylec/public_html/mysite/code/ArticlePage.php on line 18

    I thought the problem was because the upgrade notes for 2.4.0-rc1 stated that the CalendarDateField was moved to the legacydatetimefields module. It wasn't explicit about whether this was an informational statement or if it meant that I had to actually do something, so I checked the tutorial for adding a date to an article to see if it had been updated. To my surprise, it had been updated on March 31st and was still suggesting the use of the CalendarDateField format for adding the publish date to an ArticlePage.

    Since I couldn't open any pages containing a CalendarDateField and I couldn't figure out if the legacydatetimefields module mentioned in the upgrade notes was something built into sapphire or if it was something that I needed to add I simply deleted the line from the ArticlePage.php file. This solved the problem of being able to open ArticlePages in the cms, but didn't help with how to get the system to publish a post date.

    I am also having a problem saving or publishing an ArticlePage after removing the CalendarDateField. When I click on save or save and publish I get an error message that "This field should save into a HTMLText or HTMLVarchar field"

    I assume that it is referring to the author field which is defined as a TextField in the ArticlePage.php file. I did not see anything about this field type being deprecated or relegated elsewhere in the upgrade notes and the tutorial still shows the author box defined as a TextField, so I don't know what to do. I tried changing the field type to HTMLTextField then I tried HtmlTextField, but both options caused another fatal error when I tried to open the file in the cms.

    Fatal error: Class 'HTMLTextField' not found in /home/nhstylec/public_html/mysite/code/ArticlePage.php on line 19

    Can anyone tell me how to fix either of these problems? I realize that there are always challenges in an upgrade, especially when it's not the final version, but I didn't think I would hit any problems with something as basic as adding a date field.

    Thanks!

    HB

  • Invader_Zim
    Avatar
    Community Member
    141 Posts

    Re: Problem with fields in ArticlePage in 2.4.0-rc1 Link to this post

    Hi,

    i had a problem with the date-fields as well.
    But I am not using the legacydatetimefields module.
    I just changed some fields to use the new DateField.php from 2.4.0rc1 (Have a look at sapphire/form/DateField.php)

    my old code:

    $fields->addFieldToTab('Root.Content.Main', new CalendarDateField ('EntryDate', 'Entry Date:'), 'Content');

    my new code:

    // We create a js datepicker field here (@see sapphire/form/DateField.php)
    $df = new DateField('EntryDate', 'Entry Date:');
    $df->setConfig('showcalendar', true);// only works with NZ-DateFormat

    $fields->addFieldToTab('Root.Content.Main', $df, 'Content');

    This works fine for me and maybe this might help you a bit.

    Cheers,
    Christian

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Problem with fields in ArticlePage in 2.4.0-rc1 Link to this post

    Fatal error: Class 'HTMLTextField' not found in /home/nhstylec/public_html/mysite/code/ArticlePage.php on line 19

    It is meant to be HtmlEditorField. Bit confusing compared to text / editor.

  • honeybunny
    Avatar
    Community Member
    79 Posts

    Re: Problem with fields in ArticlePage in 2.4.0-rc1 Link to this post

    Will, I did try changing to HtmlEditorField when I first got the error, but it didn't make a difference. I'm thinking that my problem is probably bigger than just a field type. I'm now trying to revert back to an earlier version of SS. (and failing miserably...)

    HB

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Problem with fields in ArticlePage in 2.4.0-rc1 Link to this post

    but it didn't make a difference.

    Well that should have fixed one of the issues. What was the error you got after you fixed that?. If its to do with date time fields try the legacydatefields module to keep you going.

  • michaelhmm
    Avatar
    Community Member
    23 Posts

    Re: Problem with fields in ArticlePage in 2.4.0-rc1 Link to this post

    Had similar problems with my Article pages after the upgrade to 2.4.

    The legacydatefields module almost fixed it BUT the dates are now loaded into the CMS with the unneccessary time of

    00:00:00

    added to all dates. e.g. "28/04/2010 00:00:00"

    This causes a validation error if you try to publish modified content, and the simple fix is to get rid of the time part of the date, taking care to remove the space as well:

    "28/04/2010" not "28/04/2010 "

    This is a great shame because it breaks the Article page implimentation from the SilverStripe.org tutorial, don't you think Will R?

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