7921 Posts in 1359 Topics by 933 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Feature Requests
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
| Go to End | Next > | |
| Author | Topic: | 11124 Views |
-
Re: Feature Requests

31 January 2011 at 11:27pm Last edited: 31 January 2011 11:27pm
@idefix.
Try this
$dateField = new DateField('Date');
$dateField->setConfig('showcalendar', true);
$dateField->setValue('PRESET_VALUE_IN_HERE');
$fields->addFieldToTab("Root.Content.Main", $dateField); -
Re: Feature Requests

31 January 2011 at 11:35pm
@Blackdog
Thanks for the hint.
The preset value appears, but not the calendar!
But I want both. -
Re: Feature Requests

31 January 2011 at 11:58pm
Have you tried the following?
new DateField('Date','Date','PRESET IN HERE');
-
Re: Feature Requests

1 February 2011 at 12:20am
Sorry, Calendar is now here, but no more the preset value!
-
Re: Feature Requests

1 February 2011 at 12:23am
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.
-
Re: Feature Requests

17 February 2011 at 8:09am Last edited: 15 March 2011 1:30am
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.
| 11124 Views | ||
| Go to Top | Next > |


