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.

General Questions /

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

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

Problem with fields in ArticlePage in 2.4.0-rc1


Go to End


6 Posts   2352 Views

Avatar
honeybunny

Community Member, 79 Posts

3 April 2010 at 8:48am

Edited: 03/04/2010 8:50am

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

Avatar
Invader_Zim

Community Member, 141 Posts

4 April 2010 at 12:20am

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

Avatar
Willr

Forum Moderator, 5523 Posts

7 April 2010 at 4:49pm

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.

Avatar
honeybunny

Community Member, 79 Posts

8 April 2010 at 12:34am

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

Avatar
Willr

Forum Moderator, 5523 Posts

8 April 2010 at 4:35pm

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.

Avatar
michaelhmm

Community Member, 23 Posts

28 May 2010 at 10:02pm

Edited: 28/05/2010 10:03pm

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?