Jump to:

5540 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » DateField in Gridfield not working

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

Page: 1
Go to End
Author Topic: 531 Views
  • tonibecker
    Avatar
    Community Member
    6 Posts

    DateField in Gridfield not working Link to this post

    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
    );
    }

    }

  • martimiz
    Avatar
    Forum Moderator
    1081 Posts

    Re: DateField in Gridfield not working Link to this post

    Maybe this thread has some clues...

    531 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.