7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Date field wont save!
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 817 Views |
-
Date field wont save!

23 June 2010 at 9:44pm
I'm trying to make simple use of the DataObjectManager, I need Date, Title, and a PDF file upload. I've got it working apart from everytime I save, it doesn't save the date, only the title. This is my code...
PdfFile.php:
<?php
class PdfFile extends DataObject
{
static $db = array (
'Date' => 'Date',
'Title' => 'Text'
);static $has_one = array (
'PDF' => 'File',
'FilePage' => 'FilePage'
);public function getCMSFields_forPopup()
{
$dateField = new DateField('Date');
$dateField->setConfig('showcalendar', true);
return new FieldSet(
$dateField,
new TextField('Title'),
new FileField('PDF')
);
}
}?>
FilePage.php:
<?php
class FilePage extends Page
{
static $db = array (
);static $has_one = array (
);static $has_many = array (
'PdfFiles' => 'PdfFile'
);public function getCMSFields()
{
$f = parent::getCMSFields();
$f->addFieldToTab("Root.Content.PDF", new DataObjectManager(
$this,
'PdfFiles',
'PdfFile',
array('Date'=>'Date', 'Title'=>'Title'),
'getCMSFields_forPopup'
));return $f;
}
}class FilePage_Controller extends Page_Controller {
}?>
Any advice would be much appreciated!
Many thanks,
Vic
| 817 Views | ||
|
Page:
1
|
Go to Top |

