21286 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1661 Views |
-
DateField in SS 2.4.1

17 August 2010 at 10:27pm
Hello,
It used to be so easy in SS 2.3.7. Now it's not working in SS 2.4.1
Problem:
When entering a date in the CMS, like 08/16/2010It is - after save - converted to: Aug 16, 2010
But when you edit the page, and click save again you get the error:
'validation failed'This is because the date is as text, because when i enter the date in numbers again, it will save.
How do i fix this/ Keep the date in numbers??
Thanks!
the code: http://paste2.org/p/953549
-
Re: DateField in SS 2.4.1

17 August 2010 at 11:09pm
Working!
Complete code<?php
/**
* Defines the ArticlePage page type
*/
class ArticlePageextends Page {
static $db = array(
'Date' => 'Date',
'Author' => 'Text'
);static $has_one = array(
);function getCMSFields() {
$fields = parent::getCMSFields();
$DateField = new Datefield('Date','Date');
$DateField->setConfig('showcalendar', true);
$DateField->setConfig('dateformat', 'dd-MM-YYYY');$fields->addFieldToTab('Root.Content.Main', $DateField, 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');
return $fields;
}}
class ArticlePage_Controller extends Page_Controller {
}
?>
| 1661 Views | ||
|
Page:
1
|
Go to Top |


