Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Feature Requests

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2 3 4 5 6 7 8 9 10
Go to End
Author Topic: 13347 Views
  • Blackdog
    Avatar
    Community Member
    156 Posts

    Re: Feature Requests Link to this post

    @idefix.

    Try this

    $dateField = new DateField('Date');
    $dateField->setConfig('showcalendar', true);
    $dateField->setValue('PRESET_VALUE_IN_HERE');
    $fields->addFieldToTab("Root.Content.Main", $dateField);

  • idefix
    Avatar
    Community Member
    11 Posts

    Re: Feature Requests Link to this post

    @Blackdog

    Thanks for the hint.

    The preset value appears, but not the calendar!
    But I want both.

  • Blackdog
    Avatar
    Community Member
    156 Posts

    Re: Feature Requests Link to this post

    Have you tried the following?

    new DateField('Date','Date','PRESET IN HERE');

  • idefix
    Avatar
    Community Member
    11 Posts

    Re: Feature Requests Link to this post

    Sorry, Calendar is now here, but no more the preset value!

  • idefix
    Avatar
    Community Member
    11 Posts

    Re: Feature Requests Link to this post

    Hi Blackdog,

    This:

    $ende = new DateField('Ende','Ende', '31/10/2010');
    $ende->setConfig('showcalendar', true);
    $fields->addFieldToTab("Root.News", $ende);

    is the same as before, Calendar yes, Preset value is not visible and not even preselected in the calendar.

  • idefix
    Avatar
    Community Member
    11 Posts

    Re: Feature Requests Link to this post

    Is there any special way to format the date?

  • mirkosassetti
    Avatar
    Community Member
    20 Posts
  • idefix
    Avatar
    Community Member
    11 Posts

    Re: Feature Requests Link to this post

    Hi,
    I solved my problem:

    to prefill a datefield you have to set the DataObject-variable.
    e.g.:

    function getCMSFields() {
    $fields = parent::getCMSFields();
    $today = date("d/m/Y");
    $fldCalendar = new DatePickerField("Start","Start-Datum",$value="$today"); // $value="$today" doesn't take effect but in TextField it DOES!
    if (!$this->Start) $this->Start = $heute; // THIS is the important thing! to show in the new created DataObject Form a prefilling value
    $fields->addFieldToTab("Root.Content", $fldCalendar);
    return $fields;
    }

    Maybe somebody can save some time with this.

    13347 Views
Page: 1 2 3 4 5 6 7 8 9 10
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.