21473 Posts in 5780 Topics by 2620 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2645 Views |
-
Date Picker in CMS

23 May 2010 at 6:05am
I am running through tutorial 2 and have added Date and Author fields. However, the date fields that I have placed on the Main tab does not have a date picker. The tutorial image shows a date picker next to the field.
My enviroment: SS 2.3.3. Win2003 Server, IIS6, Helicon 3, MySQL 5.0.51a, PHP 5.2.12.
I am UK based, so not sure if my local has anything to do with it. My understanding is that NZ guys and us both use the date formats.
Any help much appreciated.
-
Re: Date Picker in CMS

23 May 2010 at 2:35pm
The tutorial may have been updated to 2.4 datefields - to show a date picker on 2.3.3 you should use CalendarDateField rather than DateField to get a calendar.
-
Re: Date Picker in CMS

1 June 2010 at 11:03am
Will. Have successfully upgraded to 2.4.0. But I am still not seeing the date picker in the CMS for the tutorial article page.
Code below for ArticlePage.php. Am I doing something wrong?
<?php
/**
* Defines the ArticlePage page type
*/
class ArticlePage extends Page {
static $db = array(
'Date' => 'Date',
'Author' => 'Text'
);
static $has_one = array(
);//adds icon to tree in CMS admin
static $icon = "themes/tutorial/images/treeicons/news";
static $defaults = array('ProvideComments' => true);function getCMSFields() {
$fields = parent::getCMSFields();$fields->addFieldToTab('Root.Content.Main', new DateField('Date'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');return $fields;
}}
class ArticlePage_Controller extends Page_Controller {
}
?>
-
Re: Date Picker in CMS

1 June 2010 at 2:20pm
Have a look at the documentation on date fields with 2.4
http://doc.silverstripe.org/datefield
$fields->addFieldToTab('Root.Content.Main', $date = new DateField('Date'), 'Content');
$dateField->setConfig('showcalendar', true); -
Re: Date Picker in CMS

30 May 2013 at 2:13pm
i know this is old, but this worked for me
$dateField = new DateField('Date');
$dateField->setConfig('showcalendar', true);
$fields->addFieldToTab('Root.Content.Blog', $dateField);
| 2645 Views | ||
|
Page:
1
|
Go to Top |


