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.

Customising the CMS /

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

DateField in Gridfield not working


Go to End


2 Posts   1254 Views

Avatar
tonibecker

Community Member, 6 Posts

5 July 2012 at 1:37am

Hey guys. I#m not able to get the datepicker working with gridfield. Some ideas?
Here's my code:
<?php
class Event extends DataObject
{
public static $db = array(
'Title' => 'Varchar(255)',
'URL' => 'Varchar(255)',
'Summary' => 'Text',
'Anchor' => 'Varchar(255)',
'Date' => 'Date'
);

public static $has_one = array(
'Thumb' => 'Image',
'EventPage' => 'EventPage'
);

public static $summary_fields = array(
'Title' => 'Title',
'URL' => 'Website URL',
'Anchor' => 'Anchor Text',
);

public function getCMSFields_forPopup() {

$thumbField = new UploadField('Thumb', 'Screenshot');
$thumbField->allowedExtensions = array('jpg', 'gif', 'png');
$datefield = new DateField('Date');
$datefield->setConfig('showcalendar', true);
$datefield->setConfig('dateformat', 'd/M/Y');
$datefield->setLocale('de_DE');

return new FieldList(
new TextField('Title', 'Title'),
new TextareaField('Summary', 'Brief Summary'),
new TextField('Anchor', 'Anchor Text'),
new TextField('URL', 'Complete Website URL (including http:// )'),
$datefield,
$thumbField
);
}

}

Avatar
martimiz

Forum Moderator, 1391 Posts

6 July 2012 at 12:06am

Maybe this thread has some clues...