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 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.

General Questions /

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

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

display calendar on booking engine.

Go to End

2 Posts   922 Views


Community Member, 107 Posts

28 May 2015 at 5:30am

Edited: 28/05/2015 5:31am

I am developing room booking like below, now i am able to add new 'Rate' via GridFeild, but is it possible in silverstripe cms, to display calenday interface with textbox on each cell, on selected month & year and save the all rate details for particular month & year.

class Room extends Page {
     * @var Array
    private static $db = array(
            'Price' => 'Decimal(19,8)',
            'Currency' => 'Varchar(3)'
    private static $has_many = array(
        'Rates' => 'Rate'

    private static $show_in_sitetree = false;    
    // ...
    public function getCMSFields() {
        // Get the fields from the parent implementation
        $fields = parent::getCMSFields();    
        $fields->addFieldToTab('Root.Main', new PriceField('Price'), 'Content');
        // Create a default configuration for the new GridField, allowing record editing
        $config = GridFieldConfig_RecordEditor::create();
        // Set the names and data for our gridfield columns
            'Date' => 'Date',
            'Room.Title'=> 'Project' // Retrieve from a has-one relationship
        // Create a gridfield to hold the student relationship    
        $ratesField = new GridField(
            'Rates', // Field name
            'Rate', // Field title
            $this->Rates(), // List of all related students
        // Create a tab named "Students" and add our field to it
        $fields->addFieldToTab('Root.Rates', $ratesField); 
                        TextField::create("Month","Enter month?"),
                        TextField::create("Yes","Enter year?")
        return $fields;
class Booking_Controller extends Page_Controller {

class Rate extends DataObject {
    private static $db = array(
		'Price' => 'Decimal(19,8)'
    private static $has_one = array(
        'Booking' => 'Booking'


Community Member, 419 Posts

28 May 2015 at 8:22pm

D: what is this!?

It sounds like you want something to enable editing directly in the gridfield without having to go into the record (row) editor, is that right? I can't really follow your explanation :/
You migth be looking for:

If you're simply wondering how to get a calendar to pop up on each datefield, you set it on the datefield's (instance) config.