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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Adding Dropdown Calendar to Popup


Go to End
Reply


2 Posts   1287 Views

Avatar
marc79

Community Member, 65 Posts

30 May 2011 at 10:30pm

Hello,

Is it possible to add a Calendar Date Picker to a Popup CMS window?

I have a basic Calendar Page :

<?php
class CalendarPage extends Page {

    static $db = array(
    	'EventDate' => 'Date',
    	'EventTime' => 'Time',
    	'EventTitle' => 'Text',
    	'EventDescription' => 'HTMLText',
    	'EventContact' => 'Text',
    	'ContactEmailAdd' => 'Text'
    );
    
    static $has_many = array(	
		'EventCalendarDate' => 'CalendarDate',
	);
     
    function getCMSFields() {
        $fields = parent::getCMSFields();
	     
	   

        $tablefield = new ComplexTableField(
            $this,
            'EventCalendarDate',
            'CalendarDate',
            array(                
		    	'EventDate' => 'Event Date',
		    	'EventTime' => 'Event Time',
		    	'EventTitle' => 'Title',
		    	'EventDescription' => 'Description',
		    	'EventContact' => 'Contact Name',
		    	'ContactEmailAdd' => 'Contact Email'
            ),

			'getCMSFields_forPopup'           	 

        );
}

class CalendarPage_Controller extends Page_Controller{
    
}

And I want to add in a Date Picker as per tutorial 2:

    $fields->addFieldToTab('Root.Content.Main', $dateField = new DateField('Date','Article Date (for example: 20/12/2010)'), 'Content');
    $dateField->setConfig('showcalendar', true);
    $dateField->setConfig('dateformat', 'dd/MM/YYYY');

But I can't figure out or find any topics on this? Is it possible?

Thanks

Marc

Avatar
BLU42 Media

Community Member, 71 Posts

1 June 2011 at 7:06am

Hey Marc-

I used UncleCheese's DatePickerField - you can find it in the DataObjectManager module. Works great in the popup!

-John