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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

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

Date Field ins't saving to database, Jquery UI calendar weirdness

Go to End

3 Posts   1713 Views


Community Member, 3 Posts

3 January 2012 at 2:23pm

Edited: 03/01/2012 2:25pm

For some reason new date fields created in an already existing install of Silverstripe (2.5.4) won't save to the database. The date field is inside a widget, perhaps that is the issue?

Code snippet:

static $db = array(
'startDate => Date',

function getCMSFields() {
return new Fieldset(
new datefield('startDate')

This generates a date field in the database and displays the field in the backend, however, whenever I try to save the page, the date disappears without getting saved. My console reports no errors. I've also tried using the datepicker calendar, but this is also unsuccssful. When the user clicks on a day, they are redirected back to the home page. That does return an error on line 859 of the jquery UI Datepicker code. The error is "can't set currentDay of undefined."

This install of SS is using the blog module, and the date fields for the BlogEntry page work perfectly. It doesn't redirect and correctly saves to the database.

If anyone has encountered this error before and/or has any ideas on fixing, I'd love to hear them!



Community Member, 175 Posts

3 January 2012 at 10:11pm

dev mode enabled?

if not, try:

by the way, snippet should look:

static $db=array(
'startDate' => 'Date'


Community Member, 3 Posts

4 January 2012 at 4:42am

My mistake, that was a typo, the code is actually correct in my php file.

I should have been more clear. Dev mode is indeed enabled. I don't get that "error saving content message" in the lower left hand corner of the backend, I actually get the "content saved successfully" message.

The only error message I get references the jQuery UI datepicker. I haven't edited the file and it works with the blog module install. The 'undefined' part seems to back up the fact that the variable in the StartDate field isn't getting saved; again I have no idea why.

I should also mention that other fields within the widget save to the database without incident.